import math

# input
T = int(input())
J = [list(map(int, input().split())) for _ in range(T)]

def juice(A_int, A, B, C, D):
    if A < B:
        ans = 'No'
        return ans
    if A <= B + C:
        if D == B:
            ans = 'Yes'
            return ans
        if D < B:
            ans = 'No'
            return ans
        l = math.floor((B + C - A) / (D - B) + 1)
        A = A + l * (D - B) # AをB+Cより大きくする
        if A in A_int:
            ans = 'Yes'
            return ans
        A_int.add(A)
        return juice(A_int, A, B, C, D)
    else:
        k = math.ceil((A - C) / B)
        A = A - k * B
        if A < 0:
            ans = 'No'
            return ans
        if (A + D) in A_int:
            ans = 'Yes'
            return ans 
        A_int.add(A + D)
        return juice(A_int, A + D, B, C, D)

for i in range(T):
    A_int = set([J[i][0]])
    A = J[i][0]
    B = J[i][1]
    C = J[i][2]
    D = J[i][3]
    print(juice(A_int, A, B, C, D))
