#include <bits/stdc++.h>
using namespace std;
int read() {
  int res = 0, fs = 1;
  char c = getchar();
  while (!(c >= '0' && c <= '9')) {
    if (c == '-') fs = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') res = res * 10 + c - '0', c = getchar();
  return res * fs;
}
void print(int x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
int n, cnt, m, a[501][505], ans, tmp, x, y;
int main() {
  cin >> ans;
  while (ans--) {
    cin >> x >> y;
    tmp = abs(x - y);
    cout << (tmp + 9) / 10 << endl;
  }
  return 0;
}
