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