#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000009;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
#pragma GCC optimize "-O3"
void solve() {
  long long a, b;
  cin >> a >> b;
  if (a == b)
    cout << 0;
  else
    cout << (abs(b - a) + 9) / 10;
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
    cout << '\n';
  }
  return 0;
}
