#A = 初期値　B = 一日の購入　C = 乳化のボーダー　D =在庫の増やす数

#A > B
#D % B >= B - C

size = int(input())
data = []
flag = 0

for i in range(size):
    ip = input().split()
    data = []
    for j in ip:
        data.append(int(j))
    #定義
    store = data[0]
    buy = data[1]
    bord = data[2]
    charge = data[3]
    buf = []
#    print(store,buy,bord,charge,buf)
    #最初の処理
    store = store % buy
    if store > bord:
        flag = 1
    #定常処理
    while store not in buf:
        buf.append(store)
        store = (store + charge) % buy
        if store > bord:
            flag = 1
            break
 #   print(buf)
    if flag == 1:
        print("No")
        flag = 0
    else:
        print("Yes")
