#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a, b, c, d;
  scanf("%lld", &n);
  while (n--) {
    scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
    if (a < b)
      printf("NO\n");
    else if (d < b)
      printf("NO\n");
    else if (d == b) {
      b = a % b;
      if (b <= c)
        printf("YES\n");
      else
        printf("NO\n");
    } else if (b <= c)
      printf("YES\n");
    else {
      long long e = a % b;
      long long r = (d - b);
      c -= e;
      b -= e;
      if (b / r - c / r > 1)
        printf("NO\n");
      else {
        int flag = 0;
        for (int i = c / r; i <= b / r; i++)
          if ((i * r > c && i * r < b)) flag = 1;
        puts(flag ? "NO" : "YES");
      }
    }
  }
  return 0;
}
