#include <bits/stdc++.h>

#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(v) int(v.size())
#define pii pair<int, int>
#define mp make_pair
#define f first
#define ll long long
#define s second
#define vec vector<int>


using namespace std;

const int N = (int) 1e6 + 10;
//const int K = (int) N * N;
const int mod = (int) 998244353;


ll a, b, c, d;

int solve() {
	if (b > d || b > a)
		return 0;
	if (c >= b) 
		return 1;
	a %= b;
	if (c < a) 
		return 0;
	map<ll, ll> w;
	ll g = __gcd(b, d);
	ll start = a;
	/*
	c < a + g * k < b
	
	c < a + g * k
	a + g * k < b
	
	c - a < g * k
	g * k < b - a

	k < (b - a) / g
	k > (c - a) / g 
	*/
	for (int i = -100000; i <= 100000; i++) {
		if (c < a + i * g && a + i * g < b)
			return 0;
	}
	return 1;
	if ((c - a) / g + 1 < (b - a + g - 1) / g - 1) return 0;
	return 1;
	while (1) {
		if (w[a]) return 1;
		assert((a - start) % g == 0);
		w[a] = 1;
		a += d;
		a %= b;
		if (c < a) 
			return 0;
	}
	return -1;
}

int main() {
	#ifdef sony
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	int t;
	cin >> t;
	while (t--) {
		cin >> a >> b >> c >> d;
		int ans = solve();
		if (ans == 0) cout << "No";
		else if (ans == 1) cout << "Yes";
		else cout << "?";
		cout << "\n";
	}
	return 0;
}