#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, a, b, x;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    if (a == b) {
      cout << 0 << endl;
      continue;
    }
    if (a < b) {
      x = (b / 10) - (a / 10);
    } else {
      x = (a / 10) - (b / 10);
    }
    if (a + x * 10 < b || b + x * 10 < a)
      cout << x + 1 << endl;
    else
      cout << x << endl;
  }
}
