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

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {
            var c = new AGC026B();
            c.Solve();

        }

    }
    public class AGC026B
    {
        public void Solve()
        {
            var N = long.Parse(Console.ReadLine());

            var ansers = new List<string>();
            for (var i = 1; i <= N; i++)
            {
                var ABCD = Console.ReadLine().Split(' ').Select(x => long.Parse(x.ToString())).ToArray();
                var A = ABCD[0];
                var B = ABCD[1];
                var C = ABCD[2];
                var D = ABCD[3];
                var alist = new List<long>();
                if(A < B)
                { 
                    ansers.Add("No");
                }
                else
                { 
                    var a = A;
                    alist.Add(a);
                    while (true)
                    {
                    
                        a = calc(a, B, C, D);
                        if (alist.Contains(a))
                        {
                            ansers.Add("Yes");
                            break;
                        }
                        if (a < B)
                        {
                            ansers.Add("No");
                            break;
                        }
                        alist.Add(a);
                    }
                }
            }
            foreach (var ans in ansers)
            {
                Console.WriteLine(ans);
            }

        }

        private long calc(long a, long b, long c, long d)
        {
            var val = a % b;
            if (val <= c)
            {
                val += d;
            }
            return val;
        }
    }
}
