t = int(input())
A = [list(map(int, input().split())) for _ in range(t)]
for i in range(t):
    state = True
    a,b,c,d = A[i]
    keep = []
    keep.append(a)
    if a < b:
        state = False
    else:
        while True:
            if a < b:
                state = False
                break
            a -= b
            if a > c:
                if (a-c)%b:
                    a -= (((a-c)//b) + 1)*b
                    if a < 0:
                        state = False
                        break
                else:
                    a = c
            a += d
            if keep.count(a) >= 2:
                temp1 = keep.index(a)
                temp2 = keep[temp1+1:].index(a) + temp1+1
                if keep[temp1:temp2] == keep[temp2:]:
                    break
            keep.append(a)
    if state:
        print('Yes')
    else:
        print('No')
