T = int(input())
A = []
B = []
C = []
D = []
for _ 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]<B[i] or D[i]<B[i]:
                print("No")
                continue
        k = 0
        tmp = []
        while True:
                dNum = (A[i] + k * D[i]) % B[i]
                if C[i] < dNum:
                        print("No")
                        break
                elif dNum in tmp:
                        print("Yes")
                        break
                else:
                        tmp.append(dNum)
                        k += 1