#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b > a)
    return gcd(b, a);
  else if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
signed main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long T;
  cin >> T;
  for (long long i = 0; i < T; i++) {
    long long A, B, C, D;
    cin >> A >> B >> C >> D;
    if (B > A) {
      cout << "NO" << endl;
    } else if (B > D) {
      cout << "NO" << endl;
    } else if (C >= B) {
      cout << "YES" << endl;
    } else {
      long long g = gcd(B, D);
      long long X = B - g + A % g;
      if (X > C) {
        cout << "NO" << endl;
      } else {
        cout << "YES" << endl;
      }
    }
  }
  return 0;
}
