#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, k, a = 0, b = 0;
    cin >> a >> b;
    if (a == b)
      cout << 0 << endl;
    else if (abs(b - a) % 10 == 0)
      cout << abs(b - a) / 10 << endl;
    else
      cout << abs(b - a) / 10 + 1 << endl;
  }
  return 0;
}
