#include <bits/stdc++.h>
using namespace std;
int solve(long long a, long long b) {
  if (a == b) return 0;
  int diff = max(a, b) - min(a, b);
  return ceil(double(diff) / 10);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a, b;
    cin >> a >> b;
    cout << solve(a, b) << '\n';
  }
}
