#include <iostream>
#include <cstdio>
#include<list>
#include<iomanip>
#include<cmath>
#include <random>
#include<queue>
#include <functional>
#include<stdio.h>
#include<assert.h>
#include<stack>
#include<sstream>
#include <cstdlib>
#include<map>
#include<algorithm>
#include<iostream>
#include<set>
#include<utility>
#include<memory.h>
#include<string>
#include<vector>
#include <unordered_map>
#include<numeric>
using namespace std;
#define ios std::ios_base::sync_with_stdio(false);
#define ll  long long
#define pb push_back
#define fi(ss) freopen (ss,"r",stdin)
#define fo(ss) freopen (ss,"w",stdout)
#define sz(v)               ((int)((v).size()))
#define all(x)          (x).begin(),(x).end()
#define REP(i, v)       for(int i=0;i<sz(v);i++)
#define ld long double
#define lp(i,n) for(int i = 0 ; i < n ; ++i)
typedef pair<double,double> pii;
typedef pair<pii,int> tri;
using namespace std;

int main() {
	ios
	int t;
	cin >> t;
	ll a,b,c,d;
	while (t--) {
		cin >> a >> b >> c >> d;
		int ops = 0;
		set<ll> seen;
		bool bad = 0;
		int ops = 100000;
		while (a > 0) {
			seen.insert(a);
			if (a < b) break;
			ll r = max(0LL,(a - c)) / b;

			if (max(0LL,(a - c)) % b != 0) {
				++r;
			}
			if (r == 0) ++r;
			a -= 1ll*r*b;
			if (a < 0) break;
			a += 1ll*d;
			if (seen.find(a) != seen.end()) {
				bad = 1;
				break;
			}
			++ops;

		}
		if (!bad) cout << "No\n";
		else cout << "Yes\n";

	}

}
