#include <bits/stdc++.h>
using namespace std;
void makePositive(long long &num) {
  if (num < 0) {
    num = num * (-1);
  }
}
long long reqSteps(long long num1, long long num2) {
  long long counter = 0, diff = num2 - num1;
  makePositive(diff);
  if ((diff % 10) == 0) {
    counter = diff / 10;
  } else {
    counter = (diff / 10) + 1;
  }
  return counter;
}
int main() {
  long long num1, num2, step;
  int t;
  cin >> t;
  while (t--) {
    cin >> num1 >> num2;
    step = reqSteps(num1, num2);
    cout << step << endl;
  }
  return 0;
}
