def nibun(func ,min_ ,max_ ):
    left = min_
    right= max_
    while not(left==right):
        mid = (left+right) //2
        tmp = func(mid)
        if tmp:
            right = mid
        else:
            left = mid+1
    return left


def solve(_input):
    A,B,C,D = list(map(int,_input.split()))
    if A<B  or D<B :
        return "No"
    #days = nibun((lambda x:A-x*B  <=  C) , 0, A )
    memo = set()
    memo.add(A)
    while A>0:
        #days= 0
        #while A-B*days>C:
        #    days+=1
        days = nibun((lambda x: A - x * B <= C), 0, A)
        A = A-B*days
        if A<0:
            return "No"
        if A in memo:
            return "Yes"
        memo.add(A)
        A+=D
    print(A)
    return "No"

    #print(A_new,days,A,B,C,D)
    if D< B:
        return "No"
    return "Yes"

N = int(input())

l = [ input()  for _ in range(N)]
for line in l:
    print(solve(line))