#include <bits/stdc++.h>
using namespace std;
int n;
int abs(int u) {
  if (u >= 0)
    return u;
  else {
    return u * -1;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    int ans = abs(x - y) / 10;
    if (abs(x - y) % 10 != 0) ans++;
    printf("%d\n", ans);
  }
  return 0;
}
