#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    int T;
    cin >> T;
    REP(_, 0, T) {
        lli A, B, C, D;
        cin >> A >> B >> C >> D;
        set<lli> used;
        bool yes = false;
        //while (true) {
        REP(i, 0, 100000) {
            lli n = (A - C + B - 1) / B;
            A -= n * B;
            if (used.count(A)) {
                yes = true;
                break;
            }
            used.insert(A);
            A += D;
            //dump(A);
            if (A < D) {
                yes = false;
                break;
            }
        }
        cout << (yes ? "Yes" : "No") << endl;
    }
    return 0;
}
