#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
void dbg() { cerr << "\n"; }
template <typename T, typename... T2>
void dbg(const T& fst, const T2&... rst) {
  cerr << fst << ": ";
  dbg(rst...);
}
int main() {
  int t;
  cin >> t;
  for (int(i) = 0; (i) < (t); (i)++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    bool ok = 1;
    for (int(i) = 0; (i) < (3000); (i)++) {
      if (a < b) {
        ok = 0;
        break;
      }
      a -= b;
      if (a <= c) a += d;
    }
    if (!ok) {
      puts("NO");
      continue;
    }
    if (d + c >= b) ok = 1;
    if (d + c < b) {
      puts("NO");
      continue;
    }
    puts("YES");
  }
  return 0;
}
