T = int(input())
for i in range(T):
    A,B,C,D = [int(i) for i in input().split()]
    S = set()
    num = A
    S.add(num)
    while(True):
        num -= B
        if num < 0:
            print("No")
            break
        else:
            if num <= C:
                num += D
            if num > C:
                num = (num - C) % B + C
                if num == C:
                    num+=C
            if num in S:
                print("Yes")
                break
            S.add(num)