#include <bits/stdc++.h>
using namespace std;
long long n;
long long mod = 1e9 + 7;
long long max(long long a, long long b) {
  if (a > b) return a;
  return b;
}
long long min(long long a, long long b) {
  if (a < b) return a;
  return b;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    long long diff = abs(b - a);
    long long mo = diff / 10;
    if (diff % 10) {
      mo++;
    }
    cout << mo << endl;
  }
}
