#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const long long LINF = 1LL << 61;
const int NIL = -1;
const int MAX = 10000;
const int MOD = 1000000007;
const double pi = 3.141592653589;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < (t); i++) {
    int a, b;
    cin >> a >> b;
    int count = 0;
    if (b >= a) {
      int count = (b - a) / 10 + 1;
      if ((b - a) % 10 == 0) count--;
      cout << count << endl;
    } else {
      int count = (a - b) / 10 + 1;
      if ((a - b) % 10 == 0) count--;
      cout << count << endl;
    }
  }
  return 0;
}
