#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    unsigned long long a[2], sub;
    cin >> a[0] >> a[1];
    sub = a[0] - a[1];
    if (sub == 1 || sub == -1)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
