#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int inline in() {
  int x = 0, c;
  for (; (unsigned)((c = getchar()) - '0') >= 10;) {
    if (c == '-') return -in();
    if (!~c) throw ~0;
  }
  do {
    x = (x << 3) + (x << 1) + (c - '0');
  } while ((unsigned)((c = getchar()) - '0') < 10);
  return x;
}
long long A, B, C, D;
string solve() {
  cin >> A >> B >> C >> D;
  if (B > D) {
    return "No";
  }
  if (A < B) {
    return "No";
  }
  if (B <= (C + 1)) {
    return "Yes";
  }
  map<long long, int> mp;
  long long now = A;
  while (1) {
    if (now - B < 0) return "No";
    long long tmp = (now - C + B - 1) / B;
    now -= tmp * B;
    if (now < 0) return "No";
    if (mp[now] == 1) return "Yes";
    mp[now] = 1;
    now += D;
  }
  return "???";
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    cout << solve() << endl;
  }
  return 0;
}
