#include <bits/stdc++.h>
using namespace std;
void solve() {
  int a, b;
  scanf("%d%d", &a, &b);
  if (b > a) swap(a, b);
  int moves = (a - b + 9) / 10;
  printf("%d\n", moves);
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    solve();
  }
}
