#include<bits/stdc++.h>
using namespace std;
using ll = long long;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll extgcd(ll a, ll b, ll &x, ll &y) { ll d; return b == 0 ? (x = 1, y = 0, a) : (d = extgcd(b, a % b, y, x), y -= a / b * x, d); }
ll modinv(ll a, ll mod = 1e9 + 7) { ll x = 0, y = 0; extgcd(a, mod, x, y); return (x + mod) % mod; }
ll modpow(ll a, ll b, ll mod = 1e9 + 7) { ll r = 1; a %= mod; while(b) { if(b & 1) r = r * a % mod; a = a * a % mod; b >>= 1; } return r; }

// #undef DEBUG
// #define DEBUG
/// {{{ DEBUG --- ///
#ifdef DEBUG
template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { o << "{"; for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? ", " : ""); o << "}"; return o; }
#ifdef USE_COUT
#define dump(...) (cout<<"["<<__LINE__<< "] "<<#__VA_ARGS__<<" = "<<make_tuple(__VA_ARGS__)<<"\n")
#else
#define dump(...) (cerr<<"["<<__LINE__<< "] "<<#__VA_ARGS__<<" = "<<make_tuple(__VA_ARGS__)<<"\n")
#endif
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":", ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream &o, tuple<T...> const &t){ o << "("; _ot<0>(o, t); o << ")"; return o; }
template<class T, class U> ostream & operator<<(ostream &o, pair<T, U> const &p) { o << "(" << p.first << ", " << p.second << ")"; return o; }
#else
template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? " " : ""); return o; }
#define dump(...) (0)
#endif
/// }}}--- ///



int sol() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  if(b > d) return 0;
  if(a < b) return 0;
  if(b - 1 <= c) return 1;

  // mod (c + 1) で線形そう
  ll m = c + 1;
  vector<ll> val(2);
  for(int i = 0; i < 2; i++) {
    if(a > c) {
      ll t = (a - c + b - 1) / b;
      t = min(t, a / b);
      a -= t * b;
    }
    if(a > c) return 0;
    dump(i, a);
    val[i] = a % m;
    if(i == 1 && val[1] < val[0]) val[0] = val[1], i--;
    if(i == 0) a += d;
  }
  ll di = ((val[1] - val[0]) % m + m) % m;
  if(di == 0) return 1;
  ll s = val[0];
  // s + k * di mod m の最大値 の変化を調べたい
  ll s1 = s + (m - 1 - s) / di * di;
  if(s1 + di < b) return 0;
  ll f1 = ((s1 + di - b) % m + m) % m;
  ll s2 = f1 + (m - 1 - f1) / di * di;
  dump(s1, s2);
  ll ds = ((s1 - s2) % di + di) % di;
  ll g = gcd(ds, di);
  if(g == 0) g = di;
  ll s3 = s2 - (m - di);
  assert(s3 >= 0);
  assert(s3 < di);
  s3 -= s3 / g * g;
  ll f = (m - di) + s3;
  dump(di, ds, g);
  if(f + di < b) return 0;
  return 1;
}
#define POS(x) cout<<((x)?"POSSIBLE":"IMPOSSIBLE")<<endl;
#define Pos(x) cout<<((x)?"Possible":"Impossible")<<endl;
#define YES(x) cout<<((x)?"YES":"NO")<<endl;
#define Yes(x) cout<<((x)?"Yes":"No")<<endl;
#define yes(x) cout<<((x)?"yes":"no")<<endl;

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int t;
  cin >> t;
  while(t--) {
    dump(t);
    Yes(sol());
  }
  return 0;
}


Measured memory_bytes: 256