#include <bits/stdc++.h>
using namespace std;
int bit[10][10001] = {0};
int long long arr[10001];
int query(int end, int mod) {
  int res = 0;
  while (end > 0) {
    res += bit[mod][end];
    end -= end & (-end);
  }
  return res;
}
void update(int idx, int start, int val, int long long n) {
  while (start <= n) {
    bit[idx][start] += val;
    start += start & (-start);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int long long n, t, p, q, r, k, maxi, mini,
      cnt = 1, a, b, c, d, e, f, m, len, x, y, z, w, ans = 0, no, minus, left,
      right, mod;
  string str;
  char st;
  bool flag = true;
  cin >> t;
  while (t--) {
    ans = 0;
    flag = false;
    mini = INT_MAX;
    maxi = INT_MIN;
    cin >> a >> b;
    k = abs(a - b);
    if (k % 10 == 0)
      cout << k / 10 << endl;
    else
      cout << k / 10 + 1 << endl;
  }
}
