#include <bits/stdc++.h>
#pragma GCC optimize("avx2, O3")
using namespace std;
mt19937 prof_rand(time(0));
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
bool check2(long long a, long long b, long long c) {
  if (b - a + 1 >= c || a % c == 0 || a % c > b % c) return true;
  return false;
}
bool check(long long A, long long B, long long C, long long D, long long E) {
  long long kek = gcd(A, C);
  long long l = (C + (D - B)) % C, r = (C + (E - B)) % C;
  vector<pair<long long, long long>> keks;
  if (r < l) {
    keks.push_back({0, r});
    keks.push_back({l, C - 1});
  } else
    keks.push_back({l, r});
  bool ok = false;
  for (auto& it : keks) ok |= check2(it.first, it.second, kek);
  return !ok;
}
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << ((a >= b && d >= b)
                 ? (c >= b || c + 1 == b || check(d % b, a % b, b, c + 1, b - 1)
                        ? "YES\n"
                        : "NO\n")
                 : "NO\n");
  }
}
