using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            //SolveA(args);
            SolveB(args);
            //SolveC(args);
            //SolveD(args);


        }
        public struct Query
        {
            public long a;
            public long b;
            public long c;
            public long d;
        }
        static void SolveB(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            long[][] q = new long[n][];
            for (int i = 0; i < n; ++i)
            {
                q[i] = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
            }

            
            for(int i=0;i<n;++i)
            {
                if( Check(q[i]))
                {
                    Console.WriteLine("Yes");
                }
                else
                {
                    Console.WriteLine("No");
                }
            }
        }

        static bool Check(long[] q )
        {
            HashSet<long> cache = new HashSet<long>();
            long errorCnt = 0;
            long a = q[0];
            long b = q[1];
            long c = q[2];
            long d = q[3];
            cache.Add(a);

            long start = a;
            long prevA = a;
            while(true)
            {
                long n = (long)Math.Ceiling((decimal)(a - c) / b);
                if (n <= 0) { n = 1; }
                a = a - b * n;
                if( a < 0) { return false; }
      
                a += d;

                if( a < prevA )
                {
                    // 初めて減少
                    long bb = start - a;
                    long m = (long)Math.Ceiling((decimal)(start - c) / bb);
                    if( m <= 0) { m = 1; }
                    if( start - bb * m < 0) { return false; } 
                    //else { return true; }
                }
                prevA = a;

                if (cache.Contains(a)) { return true; }// 循環系
                cache.Add(a);
                
                  
                errorCnt++;
                if( errorCnt >= int.MaxValue)
                {
                    Console.WriteLine("Error");
                    return true;

                }
            }
        }
    }
}
