#include <bits/stdc++.h>
int main() {
  int t, count = 0;
  std::cin >> t;
  while (t--) {
    int a, b;
    std::cin >> a >> b;
    int c = abs(b - a);
    int d = c / 10;
    int e = c % 10;
    if (e) {
      d++;
    }
    std::cout << d << std::endl;
  }
}
