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