using namespace std;
typedef long long LL;
set<LL> mySet;
bool BuyContinue(LL A,LL B,LL C,LL D)
{
	LL A1=A;
	LL B1=B;
	LL C1=C;
	LL D1=D;
	set<LL>::iterator sit;
	while (true){
		if (A1-B1<0){
			return false;
		}
		LL A2=A1%B1;
		if (A2<=C1){
			A2+=D1;
		}
		sit=mySet.find(A2);
		if (sit!=mySet.end()){
			return true;
		}else{
			mySet.insert(A2);
		}
		A1=A2;
	}

}
int main(int argc, char* argv[])
{
	LL i,T;
	cin>>T;
	vector<LL> A(T),B(T),C(T),D(T);
	for (i=0;i<T;i++){
		cin>>A[i]>>B[i]>>C[i]>>D[i];
	}
	for (i=0;i<T;i++){
		if (A[i]<B[i]){
			cout<<"No"<<endl;
			continue;
		}
		if (B[i]==1){
			cout<<"Yes"<<endl;
			continue;
		}
		if (BuyContinue(A[i],B[i],C[i],D[i])){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
		mySet.clear();
	}
	return 0;
}