#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long a, b;
  cin >> a >> b;
  long long sum, sum1, r = 0;
  if (a < b) {
    sum = b - a;
    r = sum / 10;
    if (sum % 10) r++;
  } else if (a > b) {
    sum = a - b;
    r = sum / 10;
    if (sum % 10) r++;
  }
  cout << r << endl;
  r = 0;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
