#include <bits/stdc++.h>
using namespace std;
bool bruteForce(long long a, long long b, long long c, long long d) {
  long long R = c % b;
  a -= b;
  if (a < 0) return false;
  if (a <= c) a += d;
  for (int i = 1; i <= 25000; i++) {
    if (a <= c) {
      a -= b;
      if (a < 0) return false;
      a += d;
      continue;
    }
    long long r = a % b;
    if (r >= R)
      a = c + r - R;
    else
      a = c + b + r - R;
    if (a > c) a -= b;
    if (a < 0) return false;
    if (a <= c) a += d;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int q;
  cin >> q;
  for (int qu = 1; qu <= q; qu++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    if (bruteForce(a, b, c, d))
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
