t = int(input())
r = []
for i in range(t):
    a,b,c,d = map(int, input().split())
    m = []
    a = min(a, a % b + b * ((b // c) + 1))
    while b <= a:
        print(a)
        m.append(a)
        a -= b
        if a <= c:
            a += min(d, b + d % b)
        if a in m:
            break
    if a in m:
        r.append('Yes')
    else:
        r.append('No')

print('\n'.join(r))