#include <bits/stdc++.h>
using namespace std;
inline bool isLow(char ch) { return (ch >= 'a' && ch <= 'z'); }
inline bool isUpp(char ch) { return (ch >= 'A' && ch <= 'Z'); }
inline bool isDig(char ch) { return (ch >= '0' && ch <= '9'); }
inline bool are_equal(double a, double b) {
  return fabs(a - b) < numeric_limits<double>::epsilon();
}
inline bool less_than(double a, double b) {
  return (b - a) > ((fabs(a) < fabs(b) ? fabs(b) : fabs(a)) *
                    numeric_limits<double>::epsilon());
}
inline bool greater_than(double a, double b) {
  return (a - b) > ((fabs(a) < fabs(b) ? fabs(b) : fabs(a)) *
                    numeric_limits<double>::epsilon());
}
template <typename T, typename... args>
inline string arrStr(T arr, int n) {
  stringstream s;
  s << "[ ";
  for (int i = 0; i < n - 1; i++) s << arr[i] << ", ";
  s << arr[n - 1] << " ]";
  return s.str();
}
inline void __evars_begin(int line) { cout << "#" << line << ": "; }
template <typename T>
inline void __evars_out_var(vector<T> val) {
  cout << arrStr(val, val.size());
}
template <typename T>
inline void __evars_out_var(T *val) {
  cout << arrStr(val, 10);
}
template <typename T>
inline void __evars_out_var(T val) {
  cout << val;
}
inline void __evars(vector<string>::iterator it) { cout << endl; }
template <typename T, typename... Args>
inline void __evars(vector<string>::iterator it, T a, Args... args) {
  cout << it->substr((*it)[0] == ' ', it->length()) << " = ";
  __evars_out_var(a);
  cout << "; ";
  __evars(++it, args...);
}
void in(int &n, int a[]) {
  cin >> n;
  for (__typeof(n - 1) i = (0); i <= (n - 1); i++) cin >> a[i];
}
void in(int &n, vector<int> &a) {
  cin >> n;
  a.resize(n);
  for (__typeof(n - 1) i = (0); i <= (n - 1); i++) cin >> a[i];
}
void out(int n, int a[]) {
  for (__typeof(n - 1) i = (0); i <= (n - 1); i++)
    cout << a[i] << " \n"[i + 1 == n];
}
void out(vector<int> &a) {
  for (__typeof(a.size() - 1) i = (0); i <= (a.size() - 1); i++)
    cout << a[i] << " \n"[i + 1 == a.size()];
}
template <typename T>
T power(T val, T p, T mod) {
  val %= mod;
  T result = 1;
  while (p > 0) {
    if (p & 0x1) result = (result * val) % mod;
    val = (val * val) % mod;
    p >>= 1;
  }
  return result;
}
vector<string> split(const string &s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.emplace_back(x);
  return move(v);
}
template <typename T>
T gcd(T a, T b) {
  return b == 0 ? a : gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  return (a * b) / gcd(a, b);
}
template <typename T>
string toString(T x) {
  stringstream ss;
  ss << x;
  return ss.str();
}
template <typename T>
T stringToT(string s, T a) {
  T p;
  istringstream ss(s);
  ss >> p;
  return p;
}
template <typename T>
T SOD(T n) {
  __typeof(n) sum = 0, i = 1;
  for (; i * i <= n; i++)
    sum += (n % i) ? 0 : ((((i) * (i)) == n) ? i : i + n / i);
  return sum;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, const pair<T, S> &v) {
  os << "(" << v.first << ", " << v.second << ")";
  return os;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, const map<T, S> &v) {
  for (auto it : v) os << it.first << " : " << it.second << '\n';
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &v) {
  os << "[";
  for (auto it : v) {
    os << it;
    if (it != *v.rbegin()) os << ", ";
  }
  os << "]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "[";
  for (int i = 0; i < v.size(); i++) {
    os << v[i];
    if (i != (int)v.size() - 1) os << ", ";
  }
  os << "]";
  return os;
}
const int fx[] = {+1, -1, +0, +0};
const int fy[] = {+0, +0, +1, -1};
const int fx8[] = {+0, +0, +1, -1, -1, +1, -1, +1};
const int fy8[] = {-1, +1, +0, +0, +1, +1, -1, -1};
const int kx[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int ky[] = {-1, 1, -2, 2, -2, 2, -1, 1};
int Set(int N, int pos) { return N = N | (1 << pos); }
int reset(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
const int mod = 1e9 + 7;
const int mx = 2 * 100001;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long x, y;
  int cases, tc;
  cin >> tc;
  for (cases = 1; cases <= tc; cases++) {
    cin >> x >> y;
    long long d = x - y;
    if (d == 1)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
  return 0;
}
