void main(){
  import std.stdio, std.string, std.conv, std.algorithm;
  import std.exception;

  int q; rd(q);
  while(q--){
    long a, b, c, d; rd(a, b, c, d);
    bool[long] memo;
    long cnt=0;
    while(true){
      enforce(cnt++<1_000_000);
      if(a in memo){
        writeln("Yes");
        break;
      }
      memo[a]=true;
      if(a<b){
        writeln("No");
        break;
      }
      a-=b;
      if(a<=c){
        a+=d;
      }else{
        auto n=(a-c-1)/b+1;
        if(a-b*n<0){
          writeln("No");
          break;
        }
        a=a-b*n+d;
      }
    }
  }

}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}
