T = int(input())
for i in range(T):
	A, B, C, D = list(map(int, input().split()))
	memo = set()
	def dfs(x):
		x -= B
		if x < 0:
			return 0
		x -= B*(x // B)
		if x <= C:
			x += D
		if x in memo:
			return 1			
		memo.add(x)
		return dfs(x)
	if dfs(A):
		print("YES")
	else:
		print("NO")
