import math
T = int(input())
A, B, C, D = [0 for i in range(T)], [0 for i in range(T)], [0 for i in range(T)], [0 for i in range(T)]
for i in range(T):
    A[i], B[i], C[i], D[i] =  list(map(int, input().split()))

def judge(a, b, c, d):

    if a < b: # そもそも初日から買えない
        return "No"
    if b > d:
        return "No"
    
    Seq = []
    n = (a - c)  //  b # 初期のあたりをつける
    z = a - n*b
    if z <= c:
        z += c
#    z = a　- n * b
    Seq.append(z)
#    print('in z=', z, " n=", n )
    cnt = 0
    re = "No"
    while z >= b:
        z -= b
        if z <= c:
            z += d
        cnt += 1
        if z in Seq:
            re = "Yes"
            break
        if z == a:
            re = "Yes"
            break
        # 大きい数対策
        n = (z - c) // b
        z = z - n * b
#        print('z=', z, " n=", n )
        if z <= c:
            z += d
            
        print(z, '--' , Seq)
        if z in Seq:
            print(Seq)
            re = "Yes"
            break
        else:
            Seq.append(z)
    return re

for i in range(T):
    print(judge(A[i], B[i], C[i], D[i]))