using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.Remoting.Services;
using System.Text;

namespace ConsoleApplication1
{
    internal static class Program
    {
        public static void Main(string[] args)
        {
            // AGC 026 B - rng_10s
            var scanner = new StreamScanner(Console.OpenStandardInput());
            var t = scanner.Integer();
         
            for (var i = 0; i < t; i++)
            {
                var a = scanner.Long();
                var b = scanner.Long();
                var c = scanner.Long();
                var d = scanner.Long();

                if (a <= b)
                {
                    Console.WriteLine("No");
                    continue;
                }

                var x = a; //在庫
                var xs = new HashSet<long>();
                var output = false;
                for (var j = 0; j < 1000000; j++)
                {
                    if (x < b)
                    {
                        output = true;
                        Console.WriteLine("No");
                        break;
                    }

                    x -= b;
                    
                    if (x <= c)
                    {
                        x += d;   
                    }
                    
                    if (xs.Contains(x))
                    {
                        output = true;
                        Console.WriteLine("Yes");
                        break;
                    }

                    xs.Add(x);
                }
                if (!output)
                {
                    Console.WriteLine("Yes");    
                }
            }
        }
    }
    
    // https://qiita.com/Camypaper/items/de6d576fe5513743a50e
    public class StreamScanner
    {   
        private readonly Stream stream;
        private readonly byte[] buf = new byte[1024];
        private int len, pos;
        private bool isEof = false;
        public bool IsEndOfStream => isEof;

        public StreamScanner(Stream stream) { this.stream = stream; }
        
        private byte Read()
        {
            if (isEof) throw new EndOfStreamException();
            if (pos >= len) {
                pos = 0;
                if ((len = stream.Read(buf, 0, 1024)) <= 0)
                {
                    isEof = true;
                    return 0;
                }
            }
            return buf[pos++];
        }
        
        public char Char() 
        {
            byte b = 0;
            do b = Read();
            while (b < 33 || 126 < b);
            return (char)b; 
        }
        
        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)Read())
                sb.Append(b);
            return sb.ToString();
        }
        
        public long Long()
        {
            long ret = 0; byte b = 0; var ng = false;
            do b = Read();
            while (b != '-' && (b < '0' || '9' < b));
            if (b == '-') { ng = true; b = Read(); }
            for (; true; b = Read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        
        public int Integer() { return (int)Long(); }
        public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }
    }
}
