#include <bits/stdc++.h>
using namespace std;
const int base = 200003;
const long long MM = 1ll * 1000000007 * 1000000007;
int a, b;
void Solve() {
  cin >> a >> b;
  int res = abs(a - b);
  int pos;
  if (res % 10 == 0)
    pos = 0;
  else
    pos = 1;
  cout << res / 10 + pos << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int test = 1;
  cin >> test;
  while (test--) Solve();
}
