#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return a == 0 ? b : gcd(b % a, a); }
int main() {
  int k, l, n, t;
  long long a, b, c, d, m;
  scanf("%d", &t);
  for (int i = 1; i <= t; i++) {
    scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
    if (d < b || a < b) {
      printf("NO\n");
      continue;
    }
    if ((b == d) && ((c + a / b * b) >= a)) {
      printf("YES\n");
      continue;
    }
    if (((a % b) == c) && ((d % b) == 0)) {
      printf("YES\n");
      continue;
    }
    m = gcd(a, gcd(b, gcd(c, d)));
    b = b - m;
    if (b > c) {
      printf("NO\n");
      continue;
    }
    printf("YES\n");
  }
  return 0;
}
