T = int(input())
for i in range(T):
    A, B, C, D = [int(i) for i in input().split()]
    memo = set()
    while True:
        if A in memo:
            print("Yes")
            break

        if A - B < 0:
            print("No")
            break

        if C - A + B < 0 and D - B == 0:
            print("No")
            break

        if D - B == 0:
            print("Yes")
            break

        if D - B < 0:
            print("No")
            break

        n = 1 + (C - A + B) // (D - B)
        r = (A - B) + n * (D - B)
        if r < B:
            print("No")
            break
        else:
            A = r % B
            memo.add(A)

    else:
        print("Yes")
