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

namespace P_AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var judgeCount = int.Parse(Console.ReadLine());
            for (int loopCount = 0; loopCount < judgeCount; loopCount++)
            {
                var param = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
                Console.WriteLine(IsValid(param[0], param[1], param[2], param[3]) ? "Yes" : "No");
            }
        }

        static bool IsValid(long start, long buy, long threshold, long addTo)
        {
            if(start < buy)
            {
                return false;
            }

            var okList = new HashSet<long>();

            var remaining = start;
            do
            {
                okList.Add(remaining);
                var div = remaining / buy;
                if(div == 0)
                {
                    return false;
                }

                remaining = remaining - (div * buy);
                if(remaining > threshold)
                {
                    return false;
                }

                remaining = remaining + addTo;
            } while (!okList.Contains(remaining));
            return true;
        }
    }
}
