using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;
using System.Diagnostics;
using System.Globalization;
using static System.Console;
using static System.Math;

namespace agc26_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            for(int i=0; i<n; i++){
                long[] input = ReadLine().Split().Select(long.Parse).ToArray();
                check(input[0], input[1], input[2], input[3]);
            }

            //string[] str = Console.ReadLine().Split(' ');
            //string str = Console.ReadLine();

            //Write();
            //WriteLine();
            //WriteLine("改行あり a = {0} b = {1} c = {2}", a, b, c);
            //WriteLine($"答えは{input[0]+input[1]}");
        }

        static void check(long a, long b, long c, long d){
            var list = new List<long>();
            list.Add(a);

            string judge="Yes";

            while(true){
                if(a < b){
                    judge="No";
                    break;
                }else{
                    long tmp = a/b;
                    a -= b*tmp;
                }

                if(a <= c){
                    a += d;
                }

                if(list[0] == a){
                    break;
                }
                //bool judge2=false;
                //foreach(var item in list){
                //    if(item == a){
                //        judge2=true;
                //        break;
                //    }
                //}
                //if(judge2){
                //    break;
                //}else{
                //    list.Add(a);
                //};
            }
            WriteLine(judge);
        }
    }
}