#include <bits/stdc++.h>
using namespace std;
void solve() {
  int a, b;
  cin >> a >> b;
  if (a != b) {
    if (abs(a - b) % 10 == 0)
      cout << (abs(a - b) / 10) << endl;
    else
      cout << (abs(a - b) / 10 + 1) << endl;
  } else
    cout << 0 << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
