#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c, t;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    c = ceil(abs(a - b) / 10.0);
    cout << c << endl;
  }
  return 0;
}
