#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
void solve() {
  long long a, b;
  cin >> a >> b;
  long long ans = ceil((abs(a - b)) * 1.0 / 10);
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
