#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
template <class T1, class T2>
struct cmpf {
  bool rev;
  inline bool operator()(const pair<T1, T2>& a, const pair<T1, T2>& b) const {
    return (a.first < b.first) ^ rev;
  }
  cmpf(bool b = false) { rev = b; }
};
template <class T1, class T2>
struct cmps {
  bool rev;
  inline bool operator()(const pair<T1, T2>& a, const pair<T1, T2>& b) const {
    return (a.second < b.second) ^ rev;
  }
  cmps(bool b = false) { rev = b; }
};
long long binpow(const long long& x, const long long& p, const long long& mod) {
  assert(mod > 0);
  if (p == 0) return 1;
  if (p == 1) return x % mod;
  if (p & 1) return (binpow((x * x) % mod, p / 2, mod) * x) % mod;
  return binpow((x * x) % mod, p / 2, mod) % mod;
}
template <class T>
void chmn(T& a, const T& b) {
  if (a > b) a = b;
}
template <class T>
void chmx(T& a, const T& b) {
  if (a < b) a = b;
}
void setIO(const string& filename = "") {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}
int chr[8] = {-1, 0, 1, 0, -1, -1, 1, 1};
int chc[8] = {0, 1, 0, -1, -1, 1, -1, 1};
const long long MOD = 1e9 + 7;
const int INIT = 1001001001;
const int MN = -1;
long long N, M, K;
long long A, B;
void solve(int t) {
  cin >> A >> B;
  long long diff = abs(A - B);
  cout << (diff + 9) / 10 << endl;
}
int main() {
  setIO();
  long long T = 1;
  cin >> T;
  for (int t = 1; t <= T; t++) solve(t);
  return 0;
}
