#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > vp;
vector<long long> v;
set<long long> st;
long long ara[500005];
map<string, long long> mp;
long long Set(long long N, long long pos) { return N = N | (1LL << pos); }
long long reset(long long N, long long pos) { return N = N & ~(1LL << pos); }
bool check(long long N, long long pos) { return (bool)(N & (1LL << pos)); }
vector<long long> e, o;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, i, j, p, t, a, b;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    n = abs(a - b);
    long long ans = (n / 10);
    if (n % 10 != 0) ans += 1;
    if (a == b)
      cout << 0 << endl;
    else
      cout << ans << endl;
  }
}
