from math import ceil
from collections import defaultdict
t = int(input())

# (b,c,d) -> {A -> No/Yes, ...}
memo = defaultdict(dict)
for i in range(t):
    a,b,c,d = map(int, input().split())

    if a < b:
        print('No')
        continue

    if d >= b and c+1 >= b:
        print('Yes')
        continue

    key = (b,c,d)
    if key in memo:
        for A, ans in memo[key].items():
            #print(a,A)
            if a in A:
                print(ans)
                continue

    A = set([a])
    while(True):
        if (a-c)%b == 0:
            x = (a-c)//b
        else:
            x = ceil((a-c)/b)
        if a-b*x < 0:
            print('No')
            memo[key][frozenset(A)] = 'No'
            break
        next_a = a-b*x+d
        if next_a < b:
            print('No')
            memo[key][frozenset(A)] = 'No'
            break
        if next_a in A:
            print('Yes')
            memo[key][frozenset(A)] = 'Yes'
            break
        A.add(next_a)
        if len(A) >= d:
            print('No')
            memo[key][frozenset(A)] = 'No'
            break
        a = next_a
