#include <bits/stdc++.h>
using namespace std;
long long int arr1[200002];
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long int countSetBits(long long int n) {
  long long int count = 0;
  while (n) {
    count += n & 1;
    n >>= 1;
  }
  return count;
}
bool cmp(pair<long long int, long long int>& a,
         pair<long long int, long long int>& b) {
  return a.second < b.second;
}
vector<long long int> factors(long long int n) {
  vector<long long int> v;
  for (auto i = 1; i < sqrt(n) + 1; i++) {
    if (n % i == 0) {
      v.push_back(i);
      if (n / i != i) {
        v.push_back(n / i);
      }
    }
  }
  return v;
}
long long int fac(long long int n) {
  long long int ans = 1;
  for (auto i = 2; i < n + 1; i++) {
    ans *= i;
  }
  return ans;
}
vector<long long int> v;
void luckyVector(long long int lucky, long long int add) {
  if (lucky + add < 1001) {
    lucky += add;
    v.push_back(lucky);
  } else {
    return;
  }
  luckyVector(lucky * 10, 4);
  luckyVector(lucky * 10, 7);
}
long long int getPos(vector<long long int>& arr, long long int val) {
  long long int start = 0;
  long long int end = arr.size() - 1;
  while (start <= end) {
    long long int mid = (start + end) / 2;
    if (arr[mid] == val || (mid + 1 >= arr.size() && arr[mid] < val) ||
        (mid + 1 < arr.size() && arr[mid] < val && arr[mid + 1] > val)) {
      return mid;
    } else if (arr[mid] > val) {
      end = mid - 1;
    } else {
      start = mid + 1;
    }
  }
  return -1;
}
long long int power(long long int x, long long int y, long long int p) {
  int res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int gcdExtended(int a, int b, int* x, int* y) {
  if (a == 0) {
    *x = 0, *y = 1;
    return b;
  }
  int x1, y1;
  int gcd = gcdExtended(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
long long int dr[4] = {1, -1, 0, 0};
long long int dc[4] = {0, 0, 1, -1};
long long int my_four(vector<vector<long long int>>& arr, long long int a,
                      long long int b, long long int r, long long int c) {
  for (auto k = 0; k < 4; k++) {
    long long int i = a + dr[k];
    long long int j = b + dc[k];
    if (i < 0 || j < 0) continue;
    if (i > r - 1 || j > c - 1) continue;
    if (arr[i][j] == 0) arr[i][j] = 2;
    if (arr[i][j] == 1) return -1;
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  std::cout << std::setprecision(10);
  long long int t;
  cin >> t;
  while (t--) {
    long long int a, b;
    cin >> a >> b;
    cout << abs(b - a) / 10 + ((abs(b - a) % 10 != 0) ? 1 : 0) << endl;
  }
  return 0;
}
