//AcFreak

#include<bits/stdc++.h>
#define lint long long int 
#define mp make_pair
#define pb push_back
#define f first
#define INF (lint )(1e9)
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define s second
#define endl '\n'
#define pii pair<int,int >
using namespace std;


int main()
{__
      
      lint t;
      cin>>t;

      while(t--)
      {
         lint a,b,c,d;
         cin>>a>>b>>c>>d;

         int flg=0;
         if(a<b || d<b)
            flg=1;
         if(a>=b && d>=b )
         {
            if(c>=b-1 )
               flg=0;
            else
            {
               a%=b;
               lint tb =(__gcd(b,d));
               d=tb;

               lint k=b-1-a;
               k/=tb;

               lint maxk = (a+ k*d)%b;
               if(maxk  > c)
                  flg=1;
               else
                  flg=0;
            }
         }
         if(flg)
            cout<<"NO"<<endl;
         else
            cout<<"YES"<<endl;
      }
      return 0;
}