#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    double a, b;
    cin >> a >> b;
    double k = abs(a - b);
    double m = k / 10;
    long long ans = ceil(m);
    cout << ans << "\n";
  }
  return 0;
}
