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