#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, a, b;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    if (b == a)
      cout << "0" << endl;
    else if (b > a) {
      int addition = (b - a) % 10 == 0 ? 0 : 1;
      cout << (b - a) / 10 + addition << endl;
    } else {
      int addition = (a - b) % 10 == 0 ? 0 : 1;
      cout << (a - b) / 10 + addition << endl;
    }
  }
}
