#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t, a, b, c;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    c = abs(a - b);
    div_t p;
    p = div(c, 10);
    cout << p.quot + bool(p.rem) << "\n";
  }
}
