#include <bits/stdc++.h>
#define int long long
using namespace std;

int T, A, B, C, D;

signed main(){
  
  cin>>T;
  
  while(T--){
    
    cin>>A>>B>>C>>D;
    
    if( A < B ){
      cout<<"NO"<<endl;
    }else{
    
      if( B > D ){
	cout<<"NO"<<endl;
      }
    
      if( B == D ){
      
	if( A % B <= C ) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
      
      }
    
      if( B < D ){
      
	A %= B;
      
	int b = __gcd( B, D );
      
	int L = 0, R = B / b + 5;
      
	while( L < R ){
	
	  int M = ( L + R ) / 2;
	
	  if( A + b * M < B ) L = M + 1;
	  else R = M;
	
	}
      
	if( A + b * ( L - 1 ) <= C ) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
      
      }
    
    }
  }
  return 0;
}
