T = int(input())

for i in range(T):
    A, B, C, D = list(map(int, input().split()))
    L = []
    while True:
        if A < B:
            print('No')
            break
        A = A - B * (A // B)
        if A in L:
            print('Yes')
            break
        else:
            L.append(A)
        if A <= C:
            A += D
