#include<bits/stdc++.h>
using namespace std;
int main(){
int T;
  cin>>T;
  for(int i=0;i<T;i++){
  int64_t A,B,C,D;
    cin>>A>>B>>C>>D;
    if(A<B || D<B)
      cout<<"NO"<<endl;
    else{
       if(B<=C)
         cout<<"YES"<<endl;
      else{
      int64_t g=gcd(D,B);
        int64_t a=A%B;
        if(C<a)
          cout<<"NO"<<endl;
        else{
        int64_t x=(C-a+g)/g;
          if(x*g+a<B)
            cout<<"NO"<<endl;
          else
            cout<<"YES"<<endl;
        }
      }
    }
   }
   return 0;
}