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