#include <bits/stdc++.h>
#define int long long
#define rint register int
#define fo(i, n) for(rint i = 1; i <= (n); i ++)
#define out(x) cerr << #x << " = " << x << "\n"
#define type(x) __typeof((x).begin())
#define foreach(it, x) for(type(x) it = (x).begin(); it != (x).end(); ++ it)
using namespace std;
// by hjnan
template<typename tp> inline void read(tp &x) {
  x = 0;char c = getchar(); bool f = 0;
  for(; c < '0' || c > '9'; f |= (c == '-'), c = getchar());
  for(; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
  if(f) x = -x;
}
int T, a, b, c, d;
map<int, int> mp;
main(void) {
  for(read(T); T --;) {
    read(a); read(b); read(c); read(d);
    mp.clear();
    if(b > d || a < b) puts("No");
    else {
      int ok = 0;
      fo(_, 66666) {
        a = c + (a - c) % b;
        if(a > c) a -= b;  
        if(mp.count(a)) {
          puts("Yes"); ok = 1;break;
        }
        if(a < 0) {
          break;
        }
        mp[a] = 1;
        a += d;
      }
      if(!ok) puts("No");
    }
  }
}
