#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, k, t, move, aux;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    cin >> a >> b;
    move = 0;
    if (a > b) {
      aux = a - b;
      move += aux / 10;
      if (aux % 10) move++;
    } else if (a < b) {
      aux = b - a;
      move += aux / 10;
      if (aux % 10) move++;
    }
    cout << move << '\n';
  }
  return 0;
}
