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