#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 17;
const int MOD = 1e9 + 7;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    set<long long> s;
    s.insert(a);
    bool can = true;
    while (1) {
      if (a < b) {
        can = false;
        break;
      }
      long long tmp = max((a - c) / b, 1LL);
      ;
      ;
      a -= tmp * b;
      ;
      if (a <= c) a += d;
      ;
      if (s.find(a) != s.end()) break;
      s.insert(a);
    }
    if (can)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
