#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
const int MOD = 1e4 + 7;
int n, m, q;
int main() {
  scanf("%d", &q);
  while (q--) {
    int a, b;
    scanf("%d%d", &a, &b);
    int delt = abs(a - b);
    int ans = delt / 10 + (delt % 10 != 0);
    printf("%d\n", ans);
  }
  return 0;
}
