#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  return x * f;
}
int T;
long long a, b, c, d;
int main() {
  T = read();
  while (T--) {
    cin >> a >> b >> c >> d;
    if (d < b || a < b) {
      cout << "NO\n";
      continue;
    }
    long long x = (a <= c ? a - b : a - ((a - c - 1) / b + 1) * b);
    if (x < 0) {
      cout << "NO\n";
      continue;
    }
    if (b == d) {
      cout << "YES\n";
      continue;
    }
    x = x + ((c - x) / (d - b) + 1) * (d - b) - b;
    if (x < 0) {
      cout << "NO\n";
      continue;
    }
    cout << "YES\n";
  }
  return 0;
}
