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 set = new HashSet<long>();
            set.Add(a);

            string judge="Yes";

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

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

                int set_cnt = set.Count;
                set.Add(a);
                if(set_cnt == set.Count) break;
            }
            WriteLine(judge);
        }
    }
}