#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  1 <= t <= 2000;
  cin >> t;
  while (t--) {
    int a, b, c, ans;
    1 <= a <= 1000000000;
    1 <= b <= 1000000000;
    cin >> a >> b;
    if (a >= b)
      c = a - b;
    else
      c = b - a;
    if (c % 10 == 0)
      ans = c / 10;
    else
      ans = (c / 10) + 1;
    cout << ans << endl;
  }
  return 0;
}
