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