#include <bits/stdc++.h>

#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)

#define ii pair<int, int>
#define mp make_pair
#define FF first
#define SS second

#define vi vector<int>
#define vii vector<ii>
#define ll long long
#define vll vector<ll>

#define eb emplace_back
#define ef emplace_front
#define lb lower_bound
#define ub upper_bound

#define oo 1000000007
#define OO 1000000000000000007LL

using namespace std;

#define Pro "tmp"
#define maxN 300007

int main() {
    int T;
    scanf("%d", &T);

    fto (i_test, 1, T) {
        ll a, b, c, d;
        scanf("%lld%lld%lld%lld", &a, &b, &c, &d);

        if (d < b || a < b) {
            puts("No");
            continue;
        }
        if (c >= b) {
            puts("Yes");
            continue;
        }




        bool valid = 1;
        fto (k, 1, 1000) {
            if (c+k >= b) break;
            ll tmp = ((c+k-a)%b+b)%b;
            //(k*d)%b = ((c+1-a)%b+b)%b;
            if (tmp%__gcd(d, b) == 0) {
                puts("No");
                valid = 0;
                break;
            }
        }

        if (valid) puts("Yes");
    }
    return 0;
}
