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