#include <bits/stdc++.h>
long long gcd(long long a, long long b);
int main(void) {
  int T;
  scanf("%d\n", &T);
  long long *A, *B, *C, *D;
  A = (long long *)malloc(T * sizeof(long long));
  B = (long long *)malloc(T * sizeof(long long));
  C = (long long *)malloc(T * sizeof(long long));
  D = (long long *)malloc(T * sizeof(long long));
  for (int i = 0; i < T; i++) {
    scanf("%lld %lld %lld %lld", &A[i], &B[i], &C[i], &D[i]);
  }
  long long R = 0;
  long long *rist;
  long long a, b, c, d;
  int flag = 0, g = 0, jMax = 0;
  for (int i = 0; i < T; i++) {
    a = A[i];
    b = B[i];
    c = C[i];
    d = D[i];
    if (a < b) {
      printf("No\n");
      flag++;
    }
    R = a % b;
    g = gcd(b, d);
    jMax = b / g;
    for (int j = 0; j < jMax && !flag; j++) {
      if (R > c || R + d < b) {
        printf("No\n");
        flag++;
      } else {
        R = (R + d) % b;
      }
    }
    if (!flag) printf("Yes\n");
    flag = 0;
  }
  return 0;
}
long long gcd(long long a, long long b) {
  long long r, tmp;
  if (a < b) {
    tmp = a;
    a = b;
    b = tmp;
  }
  r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
