#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  long long a, b, cnt;
  while (t--) {
    cin >> a >> b;
    cnt = 0;
    if (a > b) swap(a, b);
    cnt = (b - a) / 10;
    if ((b - a) % 10 != 0) cnt++;
    cout << cnt << endl;
  }
  return 0;
}
