#include <bits/stdc++.h>
using namespace std;
const int N = 20000005;
int n, k, x, t, a, b, m;
string s;
vector<int> v;
void solve() {
  cin >> n >> k;
  cout << (abs(n - k) + 9) / 10 << endl;
}
int main() {
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
