#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int i = 1; n >= i; i++) {
    long long a, b;
    cin >> a >> b;
    long long z = a - b;
    if (z == 1)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
