T = int(input())
a = []
for i in range(T):
    a.append(list(map(int, input().split())))
for r in a:
    a, b, c, d = r[0], r[1], r[2], r[3]
    s = a


    s_list = []
    while True:
        s_list.append(s)


        if s > 100:
            s -= b*((s//b)-1)
            while s <= c:
                s+= c
        s -= b
        if s in s_list:
            print('Yes')
            break
        s_list.append(s)


        if s <0:
            print('No')
            break
        if s != s_list[-1]:
            if s in s_list:
                print('Yes')
                break

        if s <= c:
            s += d
            s_list.append(s)
            if s != s_list[-1]:
                if s in s_list:
                    print('Yes')
                    break
