import sys
sys.setrecursionlimit(100000)

T = int(input())
A = []
B = []
C = []
D = []

def bin_search(n,lst):
    l=0
    r=len(lst)

    while r-1>=l:
        i=(l+r)//2
        if lst[i]==n: return True,i
        elif lst[i]<n: l=i+1
        else: r=i
    return False,-1

def dfs(a,b,c,d):
    if a < b: return False
    else:
        memo.append(a)
        memo.sort()
        a -= b
        flg, idx = bin_search(a,memo)
        memo.append(a)
        if flg:
            return True
        elif a <= c:
            a += d
            memo.append(a)
            dfs(a,b,c,d)
        else:
            dfs(a,b,c,d)

memo = []
for i in range(T):
    a,b,c,d = map(int,input().split())
    A.append(a)
    B.append(b)
    C.append(c)
    D.append(d)

for i in range(T):
    if A[i] < C[i]:
        if dfs(A[i],B[i],C[i],D[i]): print("Yes")
        else: print("No")

    else:
        a = A[i] - int((A[i] - C[i])/B[i])*B[i]
        if dfs(a,B[i],C[i],D[i]): print("Yes")
        else: print("No")
