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