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