#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using ll = int64_t;
using ld = double;
using ull = uint64_t;
using namespace std;
using namespace __gnu_pbds;     

ll gcd(ll a, ll b) {
    return b ? gcd(b, a % b) : a;
}

int main() {
#ifdef BZ
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout.setf(ios::fixed); cout.precision(20);
    int t;
    for (cin >> t; t--;) {
        ll a, b, c, d;
        cin >> a >> b >> c >> d;

        if (b > a || b > d) {
            cout << "No\n";
            continue;
        }

        ll g = gcd(b, d);
        ll dv = (c + d + g - a) / g;
        
        ll cur = (a + dv * g) % d;

        if (cur > c && cur < b) {
            cout << "No\n";
        } else {
            cout << "Yes\n";
        }
    }
}