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