#include <bits/stdc++.h>
using namespace std;
int T;
long long a, b, c, d;
int main() {
  scanf("%d", &T);
  while (T--) {
    bool flag = 0;
    scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
    if (a > b && a % b > c) {
      printf("NO\n");
      flag = 1;
    }
    if (a < b && !flag) {
      printf("NO\n");
      flag = 1;
    }
    if (a - b + d + b <= c && !flag) {
      printf("NO\n");
      flag = 1;
    }
    if (a - b <= c && a - b + d < b && !flag) {
      printf("NO\n");
      flag = 1;
    }
    long long now = a;
    long long m = 10000;
    while (m-- && !flag) {
      now -= b;
      if (now < 0) {
        flag = 1;
        printf("NO\n");
        break;
      }
      if (now <= c) now += d;
    }
    if (!flag) printf("YES\n");
  }
  return 0;
}
