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

namespace AGC026_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());

            bool[] flags = new bool[t];

            for (int i = 0; i < t; ++i)
            {
                string[] strs = Console.ReadLine().Split(' ');
                long a = long.Parse(strs[0]);
                long b = long.Parse(strs[1]);
                long c = long.Parse(strs[2]);
                long d = long.Parse(strs[3]);

                flags[i] = Check(a, b, c, d);

            }

            for (int i = 0; i < t; ++i)
            {
                Console.WriteLine("{0}", flags[i] ? "Yes" : "No");
            }
        }

        static bool Check(long a, long b, long c, long d)
        {
            if (a < b) return false;

            long xMod = a % b;
            long x = a / b;

            long yMod = (a - c) % b;
            long y = (a - c) / b;

            if (x == y && yMod != 0) return false;

            long a2 = xMod + d;

            if (a2 < b) return false;


            long xMod2 = a2 % b;


            x = a2 / b;
            yMod = (a2 - c) % b;
            y = (a2 - c) / b;

            if (x == y && yMod != 0) return false;

            if (xMod == xMod2) return true;

            long gcd = Gcd(a, Gcd(b, Gcd(c, d)));

            if (c + gcd < b) return false;
            //if ((c + gcd) - b + d < b) return false;
            if (d < b) return false;


            return true;
        }

        public static long Gcd(long a, long b)
        {
            if (a < b)
            {
                // 引数を入替えて自分を呼び出す
                return Gcd(b, a);
            }

            while (b != 0)
            {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }
    }
}
