#include <bits/stdc++.h>
signed main(void) {
  long long t, a, b;
  scanf("%lld", &t);
  while (t--) {
    scanf("%lld %lld", &a, &b);
    long long answ = (abs(a - b) + 9) / 10;
    printf("%lld\n", answ);
  }
}
