#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char ch = getchar();
  long long x = 0, f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long gcd(long long i, long long j) {
  if (j) return gcd(j, i % j);
  return i;
}
int main() {
  int T = read();
  while (T--) {
    long long a = read(), b = read(), c = read(), d = read();
    if ((a < b) || (b > d)) {
      printf("NO\n");
      continue;
    }
    a = a % gcd(b, d);
    long long p = c % gcd(b, d);
    if (p < a)
      c += a - p;
    else if (p >= a)
      c += gcd(b, d) - p + a;
    if ((b > c)) {
      printf("NO\n");
      continue;
    }
    printf("YES\n");
  }
}
