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