#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  vector<long long> res(t);
  for (long long i = 1; i <= t; i++) {
    long long a, b;
    cin >> a >> b;
    long long x = abs(a - b);
    long long r = x / 10;
    if (r * 10 < x) {
      r += 1;
    }
    res[i - 1] = r;
  }
  for (long long i = 0; i < t; i++) {
    cout << res[i] << endl;
  }
}
