#include <bits/stdc++.h>
int main(void) {
  int T, i, j, count;
  scanf("%d", &T);
  unsigned long long x;
  unsigned long long array[T][4];
  for (i = 0; i < T; i++) {
    for (j = 0; j < 4; j++) {
      scanf("%llu", &array[i][j]);
    }
  }
  for (i = 0; i < T; i++) {
    x = array[i][0];
    count = 0;
    while (1) {
      if (x < array[i][1]) {
        printf("NO\n");
        break;
      }
      x %= array[i][1];
      if (x <= array[i][2]) {
        x += array[i][3];
      }
      count++;
      if (count > 30) {
        printf("YES\n");
        break;
      }
    }
  }
  return 0;
}
