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]);
            }

        }

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

            string judge="Yes";

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

                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);
        }
    }
}