#include <bits/stdc++.h>
using namespace std;
int t;
int main() {
  cin >> t;
  for (int i = 1; i <= t; i++) {
    int a, b, sum;
    cin >> a >> b;
    sum = abs(a - b);
    if (sum % 10 != 0) {
      sum = sum / 10 + 1;
    } else {
      sum = sum / 10;
    }
    cout << sum << endl;
  }
  return 0;
}
