#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string.h>
#include <vector>
#include <cmath>
#include <iostream>
#include <unordered_map>
#include <queue>
using namespace std;
typedef unsigned long long ui64;
typedef long long i64;
void rng_10s() {
	int T;
	cin >> T;
	for (size_t i = 0; i < T; i++)
	{
		i64 A, B, C, D;
		cin >> A >> B >> C >> D;
		if (A < B) {
			cout << "No" << "\n";
			continue;
		}
		else if (B > D) {
			cout << "No" << "\n";
			continue;
		} 
		map<i64, bool> m;
		m[A] = true;
		i64 ad = D % B;
		for (;;)
		{
			i64 rem = A / B;
			if (rem == 0) {
				cout << "No" << "\n";
				break;
			}
			A -= (rem * B);
			if (A > C) {
				cout << "No" << "\n";
				break;
			}
			if (ad == 0) {
				cout << "Yes" << "\n";
				break;
			}
			i64 sub = B - A;
			A += (sub / ad) * ad - (sub % ad == 0) ? ad : 0;
			if (A < B && A > C) {
				cout << "No" << "\n";
				break;
			}
			A += D;
			if (m[A]) {
				cout << "Yes" << "\n";
				break;
			}
			m[A] = true;
		}
	}

}
int main() {
	rng_10s();
	return 0;
}