#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = 1e15;
using ll = __int128_t;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t;
  cin >> t;
  for (ll it = 0; it < t; it++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    bool f = true;
    if (b > d) {
      cout << "No" << endl;
      continue;
    }
    ll now = a - b;
    ll diff = d - b;
    if (now > c) {
      now -= (now - c + b - 1) / b * b;
    }
    if (now < 0 || c < now) {
      cout << "No" << endl;
      continue;
    }
    set<ll> st;
    if (b == d) {
      cout << "Yes" << endl;
      continue;
    }
    st.insert(now % diff);
    for (ll j = 0; j < 100000; j++) {
      assert(now <= c);
      ll nxt = (c + 1 - now + diff - 1) / diff;
      nxt = now + nxt * diff;
      nxt -= b;
      if (nxt < 0) {
        f = false;
        break;
      }
      now = nxt;
      if (now > c) {
        now -= (now - c + b - 1) / b * b;
      }
      if (now < 0 || c < now) {
        f = false;
        break;
      }
      if (st.count(now % diff)) break;
      st.insert(now % diff);
    }
    cout << (f ? "Yes" : "No") << endl;
  }
}
