t=int(input())
query=[]
for i in range(t):
    query.append(list(map(int,input().split())))



def cal(a,b,c,d,cnt):
    if cnt%2==0:
        a=a-b
    else:
        if a<=c:
            a=a+d
    return a

yn=[]
cnt2=0
list_a=[[]for i in range(t)]
for i in range(t):
    a=query[i][0]
    list_a[i].append(a)
    cnt=0
    while 1:
        a=cal(a,query[i][1],query[i][2],query[i][3],cnt)
        if a<0:
            yn.append(0)
            break
        

        if cnt%2==0: 
            cnt2+=1
            list_a[i].append(a)
            if a in list_a[i][:cnt2]:
                yn.append(1)
                break
        cnt+=1
        
for i in range(t):
    if yn[i]==0:
        print('No')
    else:
        print('Yes')