#include<iostream>
using namespace std;

int main(){

  int T;
  cin >> T;
  int a[T],b[T],c[T],d[T];
  for(int i=0;i<T; i++){
    cin >>a[i] >>b[i] >>c[i]>>d[i];
  }
  for(int i=0;i<T;i++){
    int day = a[i];
    if (day < b[i]) cout <<"No"<<endl;
    else{
      while(day > c[i]){
        day -= b[i];
      }
      if (day < 0) cout<< "No" << endl;
      else{
        int key1 = day;
        day += d[i];
        if (day < b[i]) {cout << "No" << endl;}
        else{
          if(day < c[i]) cout << "No" << endl;
          else{
            day -=b[i];
            while(day > c[i]){
              day -=b[i];
            }
            int key2 = day;
            int dif = key2-key1;
            //cout << key2 << dif << endl;                                      
            if (dif == 0){ cout << "Yes" << endl;}
            else if(dif < 0){cout << "No" << endl;}
            else{
              while(key1 <= c[i]){
                key1 += dif;
              }
             }
              if(b[i]>key1) cout << "No" << endl;
              else {cout << "Yes" << endl;}
            }
          }
        }
      }
    }
  }
}


