#include <bits/stdc++.h>
using namespace std;
const int nxN = 64;
int a, b;
void solve() {
  cin >> a >> b;
  int c = 0;
  int t;
  if (a != b) {
    if (a > b) {
      t = a;
      a = b;
      b = t;
    }
    b = b - a;
    c = b / 10;
    c = b % 10 != 0 ? c + 1 : c;
  }
  cout << c << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  for (int i = 1; i <= t; ++i) {
    solve();
  }
  return 0;
}
