t = int(input())
for i in range(t):
    a,b,c,d = map(int, input().split())
    lis = []
    flag = True
    while a:
        if a >= b:
            a = a%b
        else:
            break
        if a <= c:
            a += d
        if a in lis:
            print("Yes")
            flag = False
            break
        lis.append(a)
    if flag:
        print("No")