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