#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long a, b, n = 0, c = 0;
    cin >> a >> b;
    if (a >= b)
      n = a - b;
    else
      n = b - a;
    if (n == 0)
      cout << c << "\n";
    else if (n % 10 == 0) {
      c = n / 10;
      cout << c << "\n";
    } else {
      c = n / 10 + 1;
      cout << c << "\n";
    }
  }
}
