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