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