#include <iostream>
#include <string>
#include <cstring>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <stack>
using namespace std;
#define ll long long
#define maxn 105
#define angel 0x3f3f3f3f
#define eps 1e-9
#define my_angel main
#define ull unsigned long long
const ull mod=212370440130137957ll;
const int maxnode = 1000 * 100 + 10;
const int sigma_size = 28;
const ull base=1e9+7;
map<ll,int>hash;
int my_angel()
{
    ll a,b,c,d;
    int t;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
        if(a<b)
        {
            printf("No\n");
            continue;
        }
        hash.clear();
        hash[a]=1;
        int success=0;
        while(1)
        {
            if(a>c)
            {
                ll remain;
                if((a-c)%b==0)
                    remain=(a-c)/b-1;
                else
                    remain=(a-c)/b;
                a=a-remain*b;
                a-=b;
                if(a<0)
                    break;
                a+=d;
                if(a<b)
                    break;
                if(hash[a]==1)
                {
                    success=1;
                    break;
                }
                hash[a]=1;
            }
            else
            {
                a-=b;
                if(a<0)
                    break;
                a+=d;
                if(hash[a]==1)
                {
                    success=1;
                    break;
                }
                hash[a]=1;
            }
        }
        if(success)
            printf("Yes\n");
        else
            printf("No\n");
    }
    return 0;
}
