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