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