#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
void solve() {
  long long a, b, c, d;
  scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
  if (a < b || d < b) {
    puts("NO");
    return;
  } else if (b <= c + 1) {
    puts("YES");
    return;
  }
  a -= b;
  if (a <= c) a += d;
  long long g = gcd(b, d);
  long long have = a - c - 1;
  if (b <= c + have % g + 1) {
    puts("YES");
  } else {
    puts("NO");
  }
}
int main() {
  int test;
  scanf("%d", &test);
  while (test--) {
    solve();
  }
}
