#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int T;
  cin >> T;
  bool *res = new bool[T];
  for (int i = 0; i < T; i++) {
    long long x, y;
    cin >> x >> y;
    long long sub = x - y;
    res[i] = (sub == 1) ? false : true;
  }
  for (int i = 0; i < T; i++)
    if (res[i])
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  return 0;
}
