#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    long long dif = abs(a - b);
    long long res = dif / 10 + (dif % 10 != 0 ? 1 : 0);
    cout << res << endl;
  }
  return 0;
}
