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