#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed;
  int t;
  cin >> t;
  for (int ts = 0; ts < t; ts++) {
    int X, Y;
    cin >> X >> Y;
    cout << (9 + abs(X - Y)) / 10 << endl;
  }
}
