#include <bits/stdc++.h>
int main() {
  int n, step, shu1, shu2;
  scanf("%d", &n);
  while (n--) {
    scanf("%d%d", &shu1, &shu2);
    if (shu1 > shu2) {
      step = (shu1 - shu2) * 1.0 / 10 > (shu1 - shu2) / 10
                 ? (shu1 - shu2) / 10 + 1
                 : (shu1 - shu2) / 10;
    } else {
      step = (shu2 - shu1) * 1.0 / 10 > (shu2 - shu1) / 10
                 ? (shu2 - shu1) / 10 + 1
                 : (shu2 - shu1) / 10;
    }
    printf("%d\n", step);
  }
}
