#include <bits/stdc++.h>
using namespace std;
int main() {
  long int a, b, count = 0, c = 0;
  int t;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    long int l = abs(a - b);
    count = l / 10;
    c = l % 10;
    if (c > 0) count = count + 1;
    cout << count << endl;
    count = 0;
  }
}
