// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long LL;
 
template<class T>
    using min_queue = priority_queue<T, vector<T>, greater<T> >;
template<class T>
    using max_queue = priority_queue<T>;

template<class A, class B>
ostream& operator<<(ostream& s, pair<A, B> const& a){
  return s << "(" << get<0>(a) << ", " << get<1>(a) << ")";
}
 
 
template <size_t n, typename... T>
typename std::enable_if<(n >= sizeof...(T))>::type
    print_tuple(std::ostream&, const std::tuple<T...>&) { }
template <size_t n, typename... T>
typename std::enable_if<(n < sizeof...(T))>::type
    print_tuple(std::ostream& os, const std::tuple<T...>& tup) {
    if (n != 0) os << ", ";
    os << std::get<n>(tup);
    print_tuple<n+1>(os, tup);
}
template <typename... T>
std::ostream& operator << (std::ostream& os, const std::tuple<T...>& tup) {
    os << "(";
    print_tuple<0>(os, tup);
    return os << ")";
}
 
template<class T>
ostream& print_collection(ostream& s, T const& a){
  s << '[';
  for(auto it = begin(a); it != end(a); ++it){
    s << *it;
    if(it != prev(end(a))) s << ", ";
  }
  return s << ']';
}
template<class T, class U>
ostream& operator<<(ostream& s, map<T, U> const& a) { return print_collection(s, a); }
template<class T>
ostream& operator<<(ostream& s, set<T> const& a) { return print_collection(s, a); }
template<class T>
ostream& operator<<(ostream& s, vector<T> const& a) { return print_collection(s, a); }
 
const LL INF = 0x3f3f3f3f3f3f3f3fll;
const double PI = acos(-1.0), eps = 1e-7;
const int max3 = 510, max4 = 20100, max5 = 201000, max6 = 2000100, inf = 0x3f3f3f3f;
const int MOD = 1007;


int main() {
    LL a, b, c, d;
    int _;
    cin >> _;
    while (_--) {
        cin >> a >> b >> c >> d;
        if (d < b) {
            cout << "No" << endl;
            continue;
        }
        if (a < b) {
            cout << "No" << endl;
            continue;
        }
        if (c >= b) {
            cout << "Yes" << endl;
            continue;
        }
        
        
        LL gd = __gcd(d, b);
        LL mxx = b / gd * gd;
        if (mxx > c - a % b && mxx < b - a % b) {
            cout << "No" << endl;
            continue;
        }
        
        LL tmp = a % b;
        bool ok = true;
        unordered_map<LL, int> mp;
        int cnt = 300000;
        while (1) {
            cnt--;
            if (cnt <= 0) {
                break;
            }
            if (tmp < b && tmp > c) {
                ok = false;
                break;
            }
            mp[tmp] = 1;
            tmp += d;
            tmp %= b;
            if (mp[tmp] == 1) break;
        }
        if (ok) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}