#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  int T;
  cin >> T;
  vector<ll> A(T);
  vector<ll> B(T);
  vector<ll> C(T);
  vector<ll> D(T);
  for (int i = 0; i < T; i++) {
    cin >> A[i] >> B[i] >> C[i] >> D[i];
  }
  for (int i = 0; i < T; i++) {
    bool ok = true;
    ll s = A[i] - B[i];
    if (s < 0) {
      ok = false;
    }
    if (s <= C[i]) s += D[i];
    for (int j = 0; j < 100000; j++) {
      if (!ok) break;
      if (s > C[i]) {
        ll c = (s - C[i]) / B[i];
        s -= c * B[i];
        if (s > C[i]) {
          s -= B[i];
        }
        if (s > C[i]) cout << "NG" << endl;
        if (s < 0) {
          ok = false;
          break;
        }
        s += D[i];
      } else {
        s -= B[i];
        if (s < 0) {
          ok = false;
          break;
        }
        s += D[i];
      }
    }
    if (ok)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
