#include <bits/stdc++.h>
using namespace std;
signed main() {
  int T;
  cin >> T;
  for (int Case = 0; Case < (T); Case++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    vector<long long> v;
    set<long long> se;
    long long e = a;
    while (1) {
      if (se.size() >= 100000) {
        puts("No");
        goto g;
      }
      if (se.count(e)) {
        puts("Yes");
        goto g;
      }
      if (e < b) {
        puts("No");
        goto g;
      }
      if (v.size() >= 2) {
        if (v[v.size() - 2] > v.back() && v.back() < e) {
          puts("Yes");
          goto g;
        }
      }
      v.push_back(e);
      se.insert(e);
      if (e <= c) {
        e -= b;
        e += d;
      } else {
        long long f = (e - c + b - 1) / b;
        if (e - f * b < 0) {
          puts("No");
          goto g;
        }
        e = e - f * b + d;
      }
    }
  g:;
  }
}
