#include <bits/stdc++.h>
using namespace std;
long long T, x, y;
int main() {
  scanf("%lld", &T);
  while (T--) {
    scanf("%lld%lld", &x, &y);
    if (x > y) swap(x, y);
    if (y - x <= 1)
      printf("NO\n");
    else
      printf("YES\n");
  }
  return 0;
}
