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