#include <bits/stdc++.h>
int abs(int a) { return (a < 0) ? (-1) * a : a; }
int main() {
  int T, a, b;
  int x;
  scanf("%d", &T);
  while (T--) {
    scanf("%d %d", &a, &b);
    x = abs(b - a);
    printf("%d\n", (x % 10 != 0) ? x / 10 + 1 : x / 10);
  }
  return 0;
}
