#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long double a, b;
  int d;
  while (n > 0) {
    n -= 1;
    cin >> a >> b;
    if (a == b) {
      d = 0;
    } else if (a > b) {
      d = ceil((a - b) / 10);
    } else if (a < b) {
      d = ceil((b - a) / 10);
    }
    cout << d << endl;
  }
}
