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