#include <bits/stdc++.h>
using namespace std;
void test() {
  int a, b;
  cin >> a >> b;
  int d = abs(a - b);
  int ans = 0;
  for (int i = 10; i > 0; i--) {
    ans += d / i;
    d %= i;
  }
  cout << ans;
}
int main() {
  int t = 1;
  cin >> t;
  while (t--) {
    test();
    cout << endl;
  }
}
