#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long T, x, y, result;
  cin >> T;
  for (int i = 0; i < T; i++) {
    cin >> x >> y;
    unsigned long long int dif = (x > y) ? x - y : y - x;
    if (dif < 2) {
      cout << "NO \n";
    } else {
      cout << "YES \n";
    }
  }
}
