#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long a;
  long long b;
  cin >> a >> b;
  if (a > b) swap(a, b);
  long long diff = b - a;
  long long ans = diff / 10;
  if (diff % 10 != 0) ans++;
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) solve();
}
