#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ii = pair<int, int>;
using iii = pair<int, ii>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vs = vector<string>;
const int INF = INT_MAX - 5;
const ll LINF = LLONG_MAX - 5;
const int MOD = 1e9 + 7;
int t;
ll a, b, c, d;
ll gcd(ll a, ll b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
    if (a < b or a % b > c or d < b) {
      puts("NO");
      continue;
    }
    ll e = gcd(b, d);
    a %= e;
    if (b - e + a <= c) {
      puts("YES");
    } else {
      puts("NO");
    }
  }
  return 0;
}
