
def solve_sub(A,B,C,D):
    a = set((A,))
    while 1:
        A -= (max(1,(A-C)//B))*B
        #print(A,a)
        if A in a:
            b = 'Yes'
            break
        if A < 0:
            b = 'No'
            break
        a |= set((A,))
        A += D*(A<=C)
    return b

def solve():
    N = int(input())
    for i in range(N):
        A,B,C,D =  map(int,input().split())
        print(solve_sub(A,B,C,D))

if __name__ == '__main__':
    solve()