#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007LL
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<i64, i64> pi;

#define maxn 100005

i64 gcd( i64 a, i64 b )
{
    if( b==0 ) return a ;
    return gcd( b,a%b ) ;
}

int main()
{
    i64 A , B , C , D ;
    i64 i , j , k , l , m , n ;

    int t=1 , tc ;

    scanf("%d",&tc) ;

    while(t++ <= tc )
    {
        scanf("%lld %lld %lld %lld",&A,&B,&C,&D) ;

        if( A<=C ) A += ( C-A+D )/D ;

        if( C>= B-1 ) printf("YES\n") ;
        else{

            i64 d = gcd(B,D) ;
            m = ((A-C-1)/d)*d ;

            if( m > (A-B) ) printf("NO\n") ;
            else printf("YES\n") ;
        }
    }

    return 0 ;
}
