#include <bits/stdc++.h>
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int T;
  long long A, B, C, D;
  scanf("%d", &T);
  while (T--) {
    scanf("%lld%lld%lld%lld", &A, &B, &C, &D);
    if (A < B || B > D) {
      puts("NO");
      continue;
    }
    if (B <= C + 1) {
      puts("YES");
      continue;
    }
    A = A - ((A - C - 1) / B) * B;
    if (A < C) A += B;
    if (A < B) {
      puts("NO");
      continue;
    }
    long long nA = (A - B) + ((C - (A - B) - 1) / D + 1) * D;
    long long delta = nA - A;
    if (delta == 0) {
      puts("YES");
      continue;
    }
    delta = (delta % B + B) % B;
    {
      long long d = gcd(delta, B);
      if (B - C - 1 >= d) {
        puts("NO");
        continue;
      }
      long long r = (A - B) % d;
      if (((B - 1) % d >= (C + 1) % d) && (B - 1) % d >= r &&
          r >= (C + 1) % d) {
        puts("NO");
        continue;
      }
      if (((B - 1) % d < (C + 1) % d) &&
          ((B - 1) % d >= r || r >= (C + 1) % d)) {
        puts("NO");
        continue;
      }
      puts("YES");
    }
  }
  return 0;
}
