#include <bits/stdc++.h>
using namespace std;
vector<long long int> v;
long long int arr[1000100];
int main() {
  long long int i, j, k, m, n, t, x, y, dif;
  string str1, str2;
  cin >> t;
  while (t--) {
    cin >> x >> y;
    dif = x - y;
    if (dif == 1) {
      cout << "NO" << endl;
    } else
      cout << "YES" << endl;
  }
}
