#include <bits/stdc++.h>
using namespace std;
int main() {
  int test;
  cin >> test;
  while (test--) {
    long long int n, m, res = 0;
    cin >> n >> m;
    n = abs(n - m);
    cout << (n + 9) / 10 << endl;
  }
}
