#include <bits/stdc++.h>
using namespace std;
int n, a, b;
int main() {
  cin >> n;
  while (n--) {
    cin >> a >> b;
    if (a < b) swap(a, b);
    int sum = a - b;
    int step = sum / 10;
    sum -= step * 10;
    if (sum != 0) step++;
    cout << step << endl;
  }
  return 0;
}
