#include <bits/stdc++.h>
using namespace std;
mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count());
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a < b) {
      cout << "NO" << '\n';
      continue;
    }
    if (d < b) {
      cout << "NO" << '\n';
      continue;
    }
    if (c >= b) {
      cout << "YES" << '\n';
      continue;
    }
    long long tmp = gcd(b, d % b);
    long long k = (b - a % b - 1) / tmp * tmp + a % b;
    if (c + 1 <= k && k <= b - 1)
      cout << "NO" << '\n';
    else
      cout << "YES" << '\n';
  }
}
