#include <bits/stdc++.h>
#define range(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, b) for (int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x) cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
	rep(i, v.size()) { os << v[i] << (i == v.size() - 1 ? "" : " "); }
	return os;
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
	for (T& x : v) { is >> x; }
	return is;
}

signed main() {
	int t;
	cin >> t;
	while (t--) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		// show(max(0LL,d-c)/b*b)
		d -= max(0LL, d - c - 1) / b * b;

		set<int> s;
		bool no = false;
		rep(i, 1e5 / 2) {
			if (s.count(a)) { break; }
			s.emplace(a);

			a -= max(1LL, max(0LL, a - c) / b) * b;
			if (a < 0) {
				no = true;
				break;
			}
			// cout << a << endl;

			if (a <= c) a += d;
		}
		if (no)
			cout << "No" << endl;
		else if (not no)
			cout << "Yes" << endl;
		else if (*(--s.end()) > a)
			cout << "No" << endl;
	}
}
