#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
void solve() {
  long long a, b;
  cin >> a >> b;
  long long d = abs(a - b);
  cout << (d + 9) / 10 << endl;
}
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  srand(chrono::high_resolution_clock::now().time_since_epoch().count());
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
