#include<stdio.h>

int main(void){
	int N;
	scanf("%d",&N);
	long long int a[N][4];
	int judge[N] ={};
	for(int i=0;i<N;i++){
		scanf("%lld",&a[i][0]);
		scanf("%lld",&a[i][1]);
		scanf("%lld",&a[i][2]);
		scanf("%lld",&a[i][3]);
	}
	for(int i=0;i<N;i++){
		long long int x=a[i][0]-a[i][2]-a[i][1];
		a[i][0] = (a[i][0]-a[i][2]) % a[i][1];
		int y=a[i][0];
		a[i][0] +=a[i][2];

		int backup = a[i][0];

		if(!(y==0 && x>=0))
			a[i][0]-=a[i][1];
		if(a[i][0] < 0){
				judge[i]=1;
			}
		if(a[i][0]<=a[i][2]){
				a[i][0]+=a[i][3];
			}
		while(judge[i]==0){
			long long int x=a[i][0]-a[i][2]-a[i][1];
			a[i][0] = (a[i][0]-a[i][2]) % a[i][1];
			int y=a[i][0];
			a[i][0] +=a[i][2];
			if(backup == a[i][0]){
				break;
			}
			
			if(!(y==0 && x>=0)){
				a[i][0]-=a[i][1];
				
			}
			
			
			if(a[i][0] < 0){
				judge[i]=1;
			}
			if(a[i][0]<=a[i][2]){
				a[i][0]+=a[i][3];
			}
			

		}
		if(judge[i]==0){
			puts("Yes");
		}
		else{
			puts("No");
		}
	
		
	}
	return 0;
}