import numpy as np
def check(a,b,c,d):
    z = a
    ans = 'Yes'
    if a < b:
        ans = 'No'
        return ans
    z_list = [z]
    for k in range(10000000):
        print(z)
        x = (z - c)//b
        if x <= 0:
            x = 1
        z = z - b * x
        if z < 0:
            ans = 'No'
            break
        if z <= c:
            z += d
            if b > d:
                ans = 'No'
                break
            elif b == d:
                ans = 'Yes'
                break
            elif b < d:
                x = int(np.ceil((c - z)/(d - b))) + 1
                z = z + x * (d-b)
        
        if z in z_list:
            ans = 'Yes'
            break
        z_list.append(z)
#         print(z)
    return ans


t = int(input())
a = []
b = []
c = []
d = []
for k in range(t):
    aa,bb,cc,dd = list(map(int,input().split()))
    a.append(aa)
    b.append(bb)
    c.append(cc)
    d.append(dd)

aa = a
bb = b
cc = c
dd = d

for a,b,c,d in zip(aa,bb,cc,dd):
    ans = check(a,b,c,d)
    print(ans)



