#include <bits/stdc++.h>
using namespace std;
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int BitSetUp(int x, int idx) { return x = x | (1 << idx); }
int BitUnSet(int x, int idx) { return x = x & (~(1 << idx)); }
bool BitCheking(int x, int idx) { return x & (1 << idx); }
bool PowerOfTwo(int x) { return (x && !(x & (x - 1))); }
void DenTofieM() {
  long long test;
  scanf("%lld", &test);
  while (test--) {
    long long a, b;
    scanf("%lld %lld", &a, &b);
    long long p = abs(a - b);
    long long cnt = p / 10;
    if (p % 10 == 0)
      cout << cnt << "\n";
    else
      cout << cnt + 1 << "\n";
  }
}
int main() {
  DenTofieM();
  return 0;
}
