AtCoder Grand Contest 026 - rng_10s

Ringo Mart, a convenience store, sells apple juice.

On the opening day of Ringo Mart, there were A cans of juice in stock in the morning. Snuke buys B cans of juice here every day in the daytime. Then, the manager checks the number of cans of juice remaining in stock every night. If there are C or less cans, D new cans will be added to the stock by the next morning.

Determine if Snuke can buy juice indefinitely, that is, there is always B or more cans of juice in stock when he attempts to buy them. Nobody besides Snuke buy juice at this store.

Note that each test case in this problem consists of T queries.

Constraints

* 1 \leq T \leq 300
* 1 \leq A, B, C, D \leq 10^{18}
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


T
A_1 B_1 C_1 D_1
A_2 B_2 C_2 D_2
:
A_T B_T C_T D_T


In the i-th query, A = A_i, B = B_i, C = C_i, D = D_i.

Output

Print T lines. The i-th line should contain `Yes` if Snuke can buy apple juice indefinitely in the i-th query; `No` otherwise.

Examples

Input

14
9 7 5 9
9 7 6 9
14 10 7 12
14 10 8 12
14 10 9 12
14 10 7 11
14 10 8 11
14 10 9 11
9 10 5 10
10 10 5 10
11 10 5 10
16 10 5 10
1000000000000000000 17 14 999999999999999985
1000000000000000000 17 15 999999999999999985


Output

No
Yes
No
Yes
Yes
No
No
Yes
No
Yes
Yes
No
No
Yes


Input

24
1 2 3 4
1 2 4 3
1 3 2 4
1 3 4 2
1 4 2 3
1 4 3 2
2 1 3 4
2 1 4 3
2 3 1 4
2 3 4 1
2 4 1 3
2 4 3 1
3 1 2 4
3 1 4 2
3 2 1 4
3 2 4 1
3 4 1 2
3 4 2 1
4 1 2 3
4 1 3 2
4 2 1 3
4 2 3 1
4 3 1 2
4 3 2 1


Output

No
No
No
No
No
No
Yes
Yes
No
No
No
No
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
No
No
No

Source: atcoder | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
def main():
	import math

	def gcd(a, b):
		while b:
			(a, b) = (b, a % b)
		return a
	N = int(input())
	ABCD = [list(map(int, input().split())) for i in range(N)]
	for (A, B, C, D) in ABCD:
		if A < B or D < B:
			print('No')
			continue
		A %= B
		if C < A:
			print('No')
			continue
		if B == D:
			print('Yes')
			continue
		flag = True
		if (B - A - 1) % gcd(D, B) <= B - 1 - (C + 1):
			flag = False
		print('Yes' if flag else 'No')
main()


from math import ceil

def gcd(a, b):
	assert a > 0 and b > 0
	while b > 0:
		r = a % b
		a = b
		b = r
	return a

def solve(A, B, C, D):
	if A < B or D < B:
		return False
	if A % B > C:
		return False
	if D % B == 0:
		return True
	g = gcd(B, D)
	r = A % g
	return not C < B - g + r
T = int(input())
for i in range(T):
	(A, B, C, D) = [int(t) for t in input().split()]
	print('Yes' if solve(A, B, C, D) else 'No')


T = int(input())

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
for i in range(T):
	(a, b, c, d) = map(int, input().split())
	if a < b:
		print('No')
	elif d < b:
		print('No')
	elif c >= b:
		print('Yes')
	else:
		g = gcd(b, d)
		if b - g + a % g > c:
			print('No')
		else:
			print('Yes')


from fractions import gcd

def judge(A, B, C, D):
	if A < B:
		return False
	if D < B:
		return False
	if C >= B:
		return True
	g = gcd(B, D)
	return False if B - g + A % g > C else True
T = int(input())
for _ in range(T):
	(A, B, C, D) = map(int, input().split())
	if judge(A, B, C, D):
		print('Yes')
	else:
		print('No')


def gcd(x, y):
	if x < y:
		(x, y) = (y, x)
	if y == 0:
		return x
	else:
		return gcd(y, x % y)
T = int(input())
for _ in range(T):
	(A, B, C, D) = map(int, input().split())
	if D < B:
		print('No')
		continue
	if A < B:
		print('No')
		continue
	if C >= B:
		print('Yes')
		continue
	a = A % B
	d = D % B
	g = gcd(d, B)
	k = (C - a) // g
	if a + (k + 1) * g >= B:
		print('Yes')
	else:
		print('No')


import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10 ** 9))
write = lambda x: sys.stdout.write(x + '\n')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def sub(a, b, c, d):
	x1 = a - max(0, (a - (c + 1)) // b) * b
	if d < b:
		ans = 'No'
	elif a < b:
		ans = 'No'
	elif d % b == 0:
		if x1 >= b:
			ans = 'Yes'
		else:
			ans = 'No'
	else:
		k = gcd(d, b)
		x2 = x1 - (x1 - (c + 1)) // k * k
		if x2 >= b:
			ans = 'Yes'
		else:
			ans = 'No'
	return ans
t = int(input())
ans = []
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	ans.append(sub(a, b, c, d))
write('\n'.join(ans))


from fractions import gcd
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	if b > d:
		print('No')
	elif a < b:
		print('No')
	elif c >= b:
		print('Yes')
	elif c < b - gcd(b, d) + a % gcd(b, d):
		print('No')
	else:
		print('Yes')


def gcd(a, b):
	while b > 0:
		(a, b) = (b, a % b)
	return a
T = int(input())
for _ in range(T):
	(A, B, C, D) = map(int, input().split())
	if B > D or B > A:
		print('No')
		continue
	if C >= B - 1:
		print('Yes')
		continue
	a = A % B
	step = gcd(B, D)
	k = (B - a + step - 1) // step - 1
	if C - a < k * step:
		print('No')
	else:
		print('Yes')


T = int(input())
ABCD = [list(map(int, input().split())) for _ in range(T)]
from fractions import gcd
for (a, b, c, d) in ABCD:
	if a < b:
		print('No')
		continue
	l = gcd(b, d)
	a = a % b
	if a + (b - a - 1) // l * l <= c and a - a // l * l + d >= b:
		print('Yes')
	else:
		print('No')


def gcd(a, b):
	r = a % b
	while r != 0:
		(a, b, r) = (b, r, b % r)
	return b

class query:

	def __init__(self, a, b, c, d):
		self.a = a
		self.b = b
		self.c = c
		self.d = d

	def isEternal(self):
		if self.a < self.b:
			return 'No'
		if self.d < self.b:
			return 'No'
		if self.b <= self.c:
			return 'Yes'
		g = gcd(self.d, self.b)
		if self.b - g + self.a % g > self.c:
			return 'No'
		return 'Yes'
t = int(input())
querys = [query(*[int(s) for s in input().split()]) for _ in range(t)]
for q in querys:
	print(q.isEternal())


from fractions import gcd
T = int(input())
for i in range(T):
	(A, B, C, D) = map(int, input().split())
	if A < B or D < B:
		print('No')
	else:
		a = A % B
		if a > C:
			print('No')
		elif C >= B:
			print('Yes')
		else:
			g = gcd(B, D)
			if B - g + A % g > C:
				print('No')
			else:
				print('Yes')


import sys
sys.setrecursionlimit(100000)

def gcd(a, b):
	r = a % b
	if r == 0:
		return b
	else:
		return gcd(b, r)
T = int(input())
for i in range(T):
	(a, b, c, d) = list(map(int, input().split()))
	if a < b:
		print('No')
		continue
	if b > d:
		print('No')
		continue
	if c >= b:
		print('Yes')
		continue
	diff = d % b
	if diff == 0:
		if a % b <= c:
			print('Yes')
			continue
		else:
			print('No')
			continue
	g = gcd(b, diff)
	init_mod = c % b
	base_mod = init_mod % g
	if b + base_mod - g > c:
		print('No')
	else:
		print('Yes')


T = int(input())
ABCD = [list(map(int, input().split())) for _ in range(T)]
import fractions

def check(a, b, c, d):
	if b > d or a < b:
		print('No')
		return
	elif c >= b:
		print('Yes')
		return
	def_a = a % b
	a = def_a
	while True:
		a = (a + d) % b
		if a > c:
			print('No')
			return
		g = fractions.gcd(b, d)
		f = (b - a) // g
		if (b - a) % g == 0:
			f -= 1
		if g == 0 or c >= a + f * g:
			print('Yes')
			return
		print('No')
		return
for abcd in ABCD:
	check(abcd[0], abcd[1], abcd[2], abcd[3])


import sys
n = int(input())
a = []
b = []
c = []
d = []
for j in range(0, n):
	(t1, t2, t3, t4) = (int(i) for i in input().split())
	a.append(t1)
	b.append(t2)
	c.append(t3)
	d.append(t4)
for i in range(0, n):
	if a[i] < b[i]:
		print('No')
	elif d[i] < b[i]:
		print('No')
	else:
		p = b[i]
		q = d[i]
		while p % q:
			r = q
			q = p % q
			p = r
		if b[i] - q + a[i] % q > c[i]:
			print('No')
		else:
			print('Yes')


from fractions import gcd

def solve():
	(a, b, c, d) = map(int, input().split(' '))
	if a < b or d < b:
		return False
	if c >= b:
		return True
	a = a % b
	d = d % b
	x = gcd(b, d)
	k = (b - a) // x
	if (b - a) % x == 0:
		k -= 1
	return not c < a + k * x < b

def main():
	t = int(input())
	ans = []
	for _ in range(t):
		ans.append(['No', 'Yes'][solve()])
	for a in ans:
		print(a)
main()


from math import gcd
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	if b > d or b > a:
		print('No')
	else:
		tmp = gcd(b, d)
		rem = a % tmp
		min_c = (c - rem) // tmp
		if min_c + 1 >= b // tmp:
			print('Yes')
		else:
			print('No')


from math import gcd
t = int(input())
queries = [tuple((int(x) for x in input().split())) for _ in range(t)]
for (a, b, c, d) in queries:
	if a < b:
		print('No')
		continue
	if b > d:
		print('No')
		continue
	if b - c <= 1:
		print('Yes')
		continue
	g = gcd(b, d)
	m = a + (b - a) // g * g
	if m >= b:
		m -= g
	if c < m:
		print('No')
	else:
		print('Yes')


def gcd(a, b):
	return a if b == 0 else gcd(b, a % b)
(T, *L) = map(int, open(0).read().split())
for (a, b, c, d) in zip(*[iter(L)] * 4):
	if a < b or d < b:
		flag = False
	elif c >= b - 1:
		flag = True
	else:
		g = gcd(b, d)
		flag = b + a % g - g <= c
	if flag:
		print('Yes')
	else:
		print('No')


import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right
sys.setrecursionlimit(10 ** 7)

def input():
	return sys.stdin.readline()[:-1]
mod = 10 ** 9 + 7

def I():
	return int(input())

def LI():
	return list(map(int, input().split()))

def LIR(row, col):
	if row <= 0:
		return [[] for _ in range(col)]
	elif col == 1:
		return [I() for _ in range(row)]
	else:
		read_all = [LI() for _ in range(row)]
		return map(list, zip(*read_all))
import fractions
T = I()
(A, B, C, D) = LIR(T, 4)
for i in range(T):
	if A[i] < B[i]:
		print('No')
		continue
	g = fractions.gcd(B[i], D[i])
	x = A[i] % B[i] // g
	min_ = A[i] % B[i] - x * g
	x = (B[i] - 1 - A[i] % B[i]) // g
	max_ = A[i] % B[i] + x * g
	if max_ > C[i] or min_ < B[i] - D[i]:
		print('No')
	else:
		print('Yes')


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
t = int(input())
abcd_list = [[int(i) for i in input().split()] for _ in range(t)]
for i in range(len(abcd_list)):
	(a, b, c, d) = abcd_list[i]
	if b > a:
		print('No')
		continue
	if b > d:
		print('No')
		continue
	if c > b:
		print('Yes')
		continue
	g = gcd(b, d)
	max_mod_b = b - g + a % g
	if max_mod_b > c:
		print('No')
	else:
		print('Yes')


T = int(input())

def gcd(a, b):
	if a < b:
		(a, b) = (b, a)
	if b == 0:
		return 0
	while a % b:
		(a, b) = (b, a % b)
	return b
while T:
	T -= 1
	(A, B, C, D) = map(int, input().split())
	if B > A or B > D:
		print('No')
	else:
		p = A - (A - C + B - 1) // B * B
		r = D % B
		g = gcd(r, B - r)
		if p < 0:
			print('No')
		elif r == 0 or (C - r - p + g) // g * g + p - B + r >= 0:
			print('Yes')
		else:
			print('No')


def gcd(a, b):
	if a == 0:
		return b
	else:
		return gcd(b % a, a)

def solve():
	(a, b, c, d) = map(int, input().split())
	if d < b:
		return 'No'
	if a < b:
		return 'No'
	if c >= b:
		return 'Yes'
	g = gcd(d, b)
	a %= b
	if (c - a) // g != (b - a - 1) // g:
		return 'No'
	else:
		return 'Yes'
for _ in range(int(input())):
	print(solve())


import fractions as f
for i in range(int(input())):
	(a, b, c, d) = list(map(int, input().split()))
	g = f.gcd(b, d)
	if a < b or b > d or a - ((a - b) // g + 1) * g > c:
		print('No')
	else:
		print('Yes')


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
import math
import decimal
ctx = decimal.Context(prec=100, rounding=decimal.ROUND_CEILING)
for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	if a < b:
		print('No')
		continue
	if b > d:
		print('No')
		continue
	if c >= b:
		print('Yes')
		continue
	g = gcd(b, d)
	r = a % g
	_max = int(((decimal.Decimal(b, context=ctx) - decimal.Decimal(r, context=ctx)) / decimal.Decimal(g, context=ctx)).to_integral_exact(context=ctx)) * g + r - g
	if c < _max:
		print('No')
	else:
		print('Yes')


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
n = int(input())
list = [map(int, input().split()) for i in range(n)]

def check(num):
	(a, b, c, d) = list[num]
	if a < b:
		return False
	if a % b > c:
		return False
	if b > d:
		return False
	if c < b and d != b:
		if (b - a % b - 1) // gcd(b, d) != (c - a % b) // gcd(b, d):
			return False
	return True
for i in range(n):
	if check(i):
		print('Yes')
	else:
		print('No')


from fractions import gcd
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	if a < b or b > d:
		print('No')
	elif b <= c:
		print('Yes')
	else:
		g = gcd(b, d)
		if g - a % g >= b - c:
			print('Yes')
		else:
			print('No')


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
T = int(input())
for _ in range(T):
	(A, B, C, D) = map(int, input().split())
	if B > A:
		print('No')
	elif B > D:
		print('No')
	elif C >= B:
		print('Yes')
	else:
		g = gcd(B, D)
		if B - g + A % g > C:
			print('No')
		else:
			print('Yes')


from fractions import gcd
n = int(input())
h = []
for i in range(n):
	w = list(map(int, input().split()))
	h.append(w)
for i in range(n):
	(a, b, c, d) = (h[i][0], h[i][1], h[i][2], h[i][3])
	if b > a or b > d:
		print('No')
		continue
	if b <= c:
		print('Yes')
		continue
	if b - gcd(b, d) + a % gcd(b, d) <= c:
		print('Yes')
	else:
		print('No')
	continue


from fractions import gcd

def ng(a, b, c, add):
	return 0 < (b - a) % add < b - c

def solve():
	(a, b, c, d) = map(int, input().split())
	if d < b or a < b:
		return 'No'
	if c > b:
		return 'Yes'
	a %= b
	if a > c:
		return 'No'
	if d - b == 0:
		return 'Yes'
	if gcd(b, d - b) < b - c:
		return 'No'
	else:
		return 'Yes'
T = int(input())
for _ in range(T):
	print(solve())


from fractions import gcd
from functools import reduce

def gcds(*numbers):
	return reduce(gcd, numbers)
n = int(input())
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	x = gcds(a, b, c, d)
	if x != 1:
		a = a // x
		b = b // x
		c = c // x
		d = d // x
	if b > d or a < b:
		print('No')
	elif c >= b - 1:
		print('Yes')
	elif gcd(b, d) != 1:
		y = gcd(b, d)
		if b - c < y and c % y >= a % y:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


from fractions import gcd
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	if a < b or d < b:
		print('No')
		continue
	if c >= b - 1:
		print('Yes')
		continue
	g = gcd(b, d)
	print('Yes' if b + a % g - g <= c else 'No')


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def solve(a, b, c, d):
	if a < b or d < b:
		return True
	cnt = gcd(b, d)
	mi = a - b
	ma = a - c
	if ma - mi > cnt:
		return True
	elif ma - mi <= 1:
		return False
	elif (mi + cnt) // cnt * cnt < ma:
		return True
	else:
		return False
T = int(input())
for i in range(T):
	(A, B, C, D) = map(int, input().split())
	if solve(A, B, C, D):
		print('No')
	else:
		print('Yes')


import fractions as math

def read_ints():
	return [int(c) for c in input().split()]

def solve(a, b, c, d):
	if a < b:
		return False
	if d < b:
		return False
	if c >= b:
		return True
	e = a % b
	delta = d % b
	if delta == 0:
		return e <= c
	g = math.gcd(b, delta)
	maxv = b - g
	return maxv <= c

def main():
	n = int(input())
	for _ in range(n):
		print('Yes' if solve(*read_ints()) else 'No')
main()


T = int(input())
ABCD = [[int(_) for _ in input().split()] for _ in range(T)]

def gcd(x, y):
	if x < y:
		return gcd(y, x)
	elif x % y == 0:
		return y
	else:
		return gcd(y, x % y)
for (a, b, c, d) in ABCD:
	if a < b or d < b:
		print('No')
	else:
		g = gcd(b, d)
		x = g * (c // g) + a % g
		if x <= c:
			x += g
		if x >= b:
			print('Yes')
		else:
			print('No')


def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
t = int(input())
a = []
d = 0
for i in range(t):
	a.append(list(map(int, input().split())))
for j in a:
	if j[0] < j[1] or j[1] > j[3]:
		print('No')
	else:
		b = j[0] % j[1]
		k = gcd(j[1], j[3])
		c = j[0] % k
		d = j[2] % k
		if c > d:
			e = j[2] + c - d
		else:
			e = j[2] + k + c - d
		if j[1] > e:
			print('No')
		else:
			print('Yes')


import math
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	if b > a:
		print('No')
	elif b > d:
		print('No')
	elif c >= b:
		print('Yes')
	else:
		g = math.gcd(b, d)
		print('Yes' if c >= a % g + b - g else 'No')


import math
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	print('Yes' if b <= min(a, d, c + 1 + (a - c - 1) % math.gcd(b, d)) else 'No')


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	if a < b or d < b:
		print('No')
		continue
	if c >= b:
		print('Yes')
		continue
	g = gcd(d, b)
	print('Yes' if b - g + a % g <= c else 'No')


def gcd(a, b):
	if a < b:
		(a, b) = (b, a)
	while b:
		(a, b) = (b, a % b)
	return a
T = int(input())
for _ in range(T):
	(A, B, C, D) = map(int, input().split())
	if A < B or D < B:
		print('No')
	else:
		g = gcd(B, D)
		k = B // g
		r = (A - C) % B
		if r == 0:
			sm = C
		else:
			sm = C + r - B
		if sm < 0:
			print('No')
		else:
			s = sm % g
			if s + (k - 1) * g <= C:
				print('Yes')
			else:
				print('No')


def main(a, b, c, d):
	if a < b:
		return 'No'
	if d < b:
		return 'No'
	if b <= c + 1:
		return 'Yes'
	if d % b == 0:
		if a % b <= c:
			return 'Yes'
		return 'No'
	import math
	g = math.gcd(d % b, b)
	e0 = a % d
	if g * ((b - 1 - e0) // g) + e0 <= c:
		return 'Yes'
	return 'No'
t = int(input())
abcd = [list(map(int, input().split())) for _ in range(t)]
for (a, b, c, d) in abcd:
	print(main(a, b, c, d))


from fractions import gcd
t = int(input())
a = []
d = 0
for i in range(t):
	a.append(list(map(int, input().split())))
for j in a:
	if j[0] < j[1] or j[1] > j[3]:
		print('No')
	else:
		b = j[0] % j[1]
		k = gcd(j[1], j[3])
		c = j[0] % k
		d = j[2] % k
		if c > d:
			e = j[2] + c - d
		else:
			e = j[2] + k + c - d
		if j[1] > e:
			print('No')
		else:
			print('Yes')


t = int(input())

def gcd(a, b):
	if a < b:
		(a, b) = (b, a)
	if b == 0:
		return a
	return gcd(b, a % b)
for i in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	if a < b or b > d or a % b > c:
		print('No')
	elif b == d:
		print('Yes')
	elif b - gcd(b, d) <= c:
		print('Yes')
	else:
		print('No')


from fractions import gcd
n = int(input())
A = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
	(a, b, c, d) = A[i]
	g = gcd(b, d)
	if a < b or b > d or b - g + a % g > c:
		print('No')
	else:
		print('Yes')


def solve(P):
	(A, B, C, D) = P
	if A < B or D < B:
		return False
	if C >= B - 1:
		return True
	g = gcd(B, D)
	return B + A % g - g <= C
from math import gcd
T = int(input())
for _ in range(T):
	P = map(int, input().split())
	print('Yes' if solve(P) else 'No')


def i1():
	return int(input())

def i2():
	return [int(i) for i in input().split()]
t = i1()

def gcd(a, b):
	while b:
		if a < b:
			c = b
			b = a
			a = c
		if b:
			a %= b
	return a
for i in range(t):
	[a, b, c, d] = i2()
	if a < b:
		print('No')
	elif d < b:
		print('No')
	elif c >= b:
		print('Yes')
	else:
		g = gcd(b, d)
		x = b - g + a % g
		if x > c:
			print('No')
		else:
			print('Yes')


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
T = int(input())
a = []
for i in range(T):
	a.append(list(map(int, input().split())))
for r in a:
	(s, b, c, d) = (r[0], r[1], r[2], r[3])
	mod_list = []
	if s < b or b > d:
		print('No')
		continue
	if c > b:
		print('Yes')
		continue
	g = gcd(b, d)
	if b - g + s % g > c:
		print('No')
	else:
		print('Yes')


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
t = int(input())
for sdghsoewrgoijof in range(t):
	s = input().split()
	(a, b, c, d) = (int(s[0]), int(s[1]), int(s[2]), int(s[3]))
	if a < b or d < b:
		print('No')
		continue
	if a == b:
		if d < b:
			print('No')
			continue
		elif d == b:
			print('Yes')
			continue
		else:
			a = d
	if a % b > c:
		print('No')
		continue
	if d % b == 0:
		print('Yes')
	else:
		g = gcd(b, d)
		if b + a % g - g > c:
			print('No')
		else:
			print('Yes')


from math import ceil
from fractions import gcd

def solve(A, B, C, D):
	if A < B or D < B:
		return False
	if A % B > C:
		return False
	if D % B == 0:
		return True
	g = gcd(B, D)
	r = A % g
	return not C < B - g + r
T = int(input())
for i in range(T):
	(A, B, C, D) = [int(t) for t in input().split()]
	print('Yes' if solve(A, B, C, D) else 'No')


from fractions import gcd
n = int(input())
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	g = gcd(b, d)
	print('Yes' if (b // g - 1) * g + a % b % g <= c and a >= b and (d >= b) else 'No')


import sys
YES = 'Yes'
NO = 'No'

def gcd(a, b):
	if b > a:
		(a, b) = (b, a)
	while b > 0:
		(a, b) = (b, a % b)
	return a

def solve(T: int, A: 'List[int]', B: 'List[int]', C: 'List[int]', D: 'List[int]'):
	for i in range(T):
		(a, b, c, d) = (A[i], B[i], C[i], D[i])
		if a < b or b > d:
			print('No')
			continue
		x = (c - a + 1) % b
		g = gcd(b, d)
		print('No' if -(-x // g * g) - x + c + 1 < b else 'Yes')
	return

def main():

	def iterate_tokens():
		for line in sys.stdin:
			for word in line.split():
				yield word
	tokens = iterate_tokens()
	T = int(next(tokens))
	A = [int()] * T
	B = [int()] * T
	C = [int()] * T
	D = [int()] * T
	for i in range(T):
		A[i] = int(next(tokens))
		B[i] = int(next(tokens))
		C[i] = int(next(tokens))
		D[i] = int(next(tokens))
	solve(T, A, B, C, D)
main()


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
import math
for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	if a < b:
		print('No')
		continue
	if b > d:
		print('No')
		continue
	if c >= b:
		print('Yes')
		continue
	g = gcd(b, d)
	r = a % g
	_max = (b - r + g - 1) // g * g + r - g
	if c < _max:
		print('No')
	else:
		print('Yes')


import math
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	if a < b or b > d:
		print('No')
		continue
	g = math.gcd(b, d)
	max_rem = b - g + a % g
	if max_rem > c:
		print('No')
	else:
		print('Yes')


T = int(input())

def gcd(a, b):
	if a < b:
		(a, b) = (b, a)
	while b > 0:
		c = a % b
		a = b
		b = c
	return a
YES = 'Yes'
NO = 'No'
for i in range(T):
	(A, B, C, D) = map(int, input().split())
	if D < B or A < B:
		print(NO)
		continue
	D = D % B
	if C >= B:
		print(YES)
		continue
	rest = A % B
	if rest > C:
		print(NO)
		continue
	if D == 0:
		print(YES)
		continue
	g = gcd(B, D)
	left = C - rest
	right = B - rest
	n = left // g + 1
	if n * g < right:
		print(NO)
	else:
		print(YES)


import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def solve(A, B, C, D):
	if B > A:
		return 'No'
	if B > D:
		return 'No'
	if B <= C:
		return 'Yes'
	g = gcd(B, D)
	if B - g + A % g > C:
		return 'No'
	else:
		return 'Yes'
T = int(input())
for t in range(T):
	(A, B, C, D) = map(int, input().split())
	print(solve(A, B, C, D))


from fractions import gcd
(T, *L) = map(int, open(0).read().split())
for (a, b, c, d) in zip(*[iter(L)] * 4):
	if b > d:
		print('No')
		continue
	if a < b:
		print('No')
		continue
	if c > b:
		print('Yes')
		continue
	g = gcd(b, d)
	x = a - b
	M = ((c - x) // g + 1) * g + x
	if M >= b:
		print('Yes')
	else:
		print('No')


from math import gcd

def solve():
	T = int(input())
	ans = ['No'] * T
	for i in range(T):
		(A, B, C, D) = map(int, input().split())
		if A < B:
			continue
		now = A - -(-(A - C) // B) * B
		if now < 0:
			continue
		if D < B:
			continue
		if D % B == 0:
			ans[i] = 'Yes'
			continue
		if C >= B:
			ans[i] = 'Yes'
			continue
		if B - gcd(D % B, B) > C:
			continue
		ans[i] = 'Yes'
	return ans
print(*solve(), sep='\n')


import os
import sys
from fractions import gcd
if os.getenv('LOCAL'):
	sys.stdin = open('_in.txt', 'r')
sys.setrecursionlimit(2147483647)
INF = float('inf')
IINF = 10 ** 18
MOD = 10 ** 9 + 7
T = int(sys.stdin.readline())
ABCD = [list(map(int, sys.stdin.readline().split())) for _ in range(T)]

def solve(A, B, C, D):
	if B > D:
		return False
	if A < B:
		return False
	if C >= B:
		return True
	p = gcd(D, B)
	if p < B - C:
		return False
	if (B - A - 1) % p < B - C - 1:
		return False
	return True
ans = []
for (a, b, c, d) in ABCD:
	ans.append('Yes' if solve(a, b, c, d) else 'No')
print(*ans, sep='\n')


def main():
	from fractions import gcd
	n = int(input())
	for _ in range(n):
		(a, b, c, d) = list(map(int, input().split()))
		if a < b or b > d:
			print('No')
			continue
		k = (a - c - 1) // b + 1
		e = a - b * k
		if e < 0:
			print('No')
			continue
		if b <= c + 1 and b <= d:
			print('Yes')
			continue
		g = gcd(b, d)
		if b - c > g:
			print('No')
		else:
			print('Yes')
main()


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
T = int(input())
for _ in range(T):
	(A, B, C, D) = map(int, input().split())
	if D < B or A < B:
		print('No')
		continue
	x = A - (A - C + B - 1) // B * B
	g = gcd(B, D)
	l = (C - x) % g
	if C - B + g - l >= 0:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	if d - b < 0:
		print('No')
		continue
	if a - b < 0:
		print('No')
		continue
	big = int(b)
	sml = int(d)
	while sml != 0:
		(big, sml) = (sml, big % sml)
	gcd = big
	r = (a - c - 1) % gcd + 1
	if r + c >= b:
		print('Yes')
	else:
		print('No')


from fractions import gcd
T = int(input())
for _ in range(T):
	(a, b, c, d) = map(int, input().split())
	if b > a or b > d:
		flg = False
	elif b - 1 <= c:
		flg = True
	elif a % b > c:
		flg = False
	else:
		g = gcd(d, b)
		if (b - 1 - a % b) // g * g + a % b <= c:
			flg = True
		else:
			flg = False
	if flg:
		print('Yes')
	else:
		print('No')


def getInput():
	in_row = [int(x) for x in input().split(' ')]
	return in_row

def gcd(n1, n2):
	while n1 % n2 != 0:
		if n1 < n2:
			(n1, n2) = (n2, n1)
		n1 %= n2
	return n2

def judgeTakahashi(in_row):
	A = in_row[0]
	B = in_row[1]
	C = in_row[2]
	D = in_row[3]
	g = gcd(B, D)
	if B > A:
		return False
	if B > D:
		return False
	if C >= B:
		return True
	if B - g + A % g > C:
		return False
	else:
		return True
N = int(input())
assert gcd(1071, 1029) == 21, 'error'
assert not judgeTakahashi([1, 10, 1, 1]), 'error'
for i in range(N):
	in_row = getInput()
	result = 'Yes' if judgeTakahashi(in_row) else 'No'
	print(result)


import sys
sys.setrecursionlimit(2147483647)
INF = float('inf')
MOD = 10 ** 9 + 7
input = lambda : sys.stdin.readline().rstrip()
from fractions import gcd

def resolve():
	for _ in range(int(input())):
		(a, b, c, d) = map(int, input().split())
		if a < b:
			print('No')
			continue
		if b > d:
			print('No')
			continue
		if c >= b:
			print('Yes')
			continue
		g = gcd(b, d)
		a %= g
		a -= g
		u = (c - a) // g + 1
		if a + u * g >= b:
			print('Yes')
		else:
			print('No')
resolve()


def gcd(a, b):
	(a, b) = (max(a, b), min(a, b))
	if b == 0:
		return a
	return gcd(b, a % b)

def check(A, B, C, D):
	if A < B:
		return False
	if C < A % B:
		return False
	if D < B:
		return False
	x = gcd(B, D)
	return B <= C + x

def main():
	T = int(input())
	for _ in range(T):
		(A, B, C, D) = map(int, input().split())
		if check(A, B, C, D):
			print('Yes')
		else:
			print('No')
main()


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def judge(A, B, C, D):
	if B > A or B > D:
		return False
	if B <= C:
		return True
	g = gcd(B, D)
	a = A % g
	return a - g < C + 1 - B
T = int(input())
for _ in range(T):
	bl = judge(*map(int, input().split()))
	print('Yes' if bl else 'No')


from fractions import *
(_, *t) = open(0)
for t in t:
	(a, b, c, d) = map(int, t.split())
	g = gcd(b, d)
	print('YNeos'[b > min(a, d) or b - g + a % g > c::2])


from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
	return int(input())

def reads():
	return [int(x) for x in input().split()]

def gcd(a, b):
	return a if b == 0 else gcd(b, a % b)

def solve(A, B, C, D):
	if A < B or D < B:
		print('  V1', file=stderr)
		return False
	CC = C + 1
	if B <= CC:
		print('  V2', file=stderr)
		return True
	g = gcd(D, B)
	if CC <= B - g:
		print('  V3', file=stderr)
		return False
	else:
		print('  V4', file=stderr)
		return A % g < CC % g
T = read()
for _ in range(T):
	(A, B, C, D) = reads()
	print('Yes' if solve(A, B, C, D) else 'No')


import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul
sys.setrecursionlimit(10000)

def read_int():
	return int(input())

def read_int_n():
	return list(map(int, input().split()))

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

def read_str():
	return input()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

def gcd(a, b):
	if a < b:
		return gcd(b, a)
	if b == 0:
		return a
	return gcd(b, a % b)

def slv2(A, B, C, D):
	if A < B:
		return 'No'
	if D < B:
		return 'No'
	if C >= B:
		return 'Yes'
	g = gcd(B, D)
	if B - g + A % g > C:
		return 'No'
	return 'Yes'

@mt
def slv(T, Q):
	a = []
	for q in Q:
		a.append(slv2(*q))
	return '\n'.join(a)

def main():
	T = read_int()
	Q = [read_int_n() for _ in range(T)]
	print(slv(T, Q))
main()


from fractions import gcd

def main():
	T = int(input())
	for _ in range(T):
		(A, B, C, D) = map(int, input().split())
		ans = True
		if B > D or B > A:
			ans = False
		elif B <= C:
			pass
		else:
			i = A % B
			if C < i:
				ans = False
			g = gcd(B, D)
			if g and (not ((C - i) // g * g + i <= C and B <= (C - i) // g * g + i + g)):
				ans = False
		print('YNeos'[not ans::2])
main()


def Yes():
	print('Yes')

def No():
	print('No')

def gcd(x, y):
	b = max(x, y)
	s = min(x, y)
	r = b % s
	while r != 0:
		b = s
		s = r
		r = b % s
	return s

def lcm(x, y):
	return x * y // gcd(x, y)

def main():
	T = int(input())
	AD = [list(map(int, input().split())) for i in range(T)]
	for i in AD:
		A = i[0]
		B = i[1]
		C = i[2]
		D = i[3]
		if A < B:
			No()
			continue
		if B > D:
			No()
			continue
		add = D - B
		d = gcd(B, D)
		C += 1
		t = C % d
		k = A % d
		if k == t:
			LD = C
		elif k > t:
			LD = C + k - t
		else:
			LD = C + d - t + k
		if LD < B:
			No()
		else:
			Yes()
main()


import sys
from fractions import gcd
sr = lambda : sys.stdin.readline().rstrip()
ir = lambda : int(sr())
lr = lambda : list(map(int, sr().split()))
T = ir()

def check(a, b, c, d):
	if a < b or d < b:
		answer = 'No'
	elif c >= b:
		answer = 'Yes'
	else:
		a %= b
		d %= b
		g = gcd(b, d)
		if b - g + a % g > c:
			answer = 'No'
		else:
			answer = 'Yes'
	print(answer)
for _ in range(T):
	check(*lr())


T = int(input())
ABCD = [list(map(int, input().split())) for i in range(T)]
from fractions import gcd

def f(a):
	print(['No', 'Yes'][a])
for (a, b, c, d) in ABCD:
	if a < b:
		f(0)
	elif d < b:
		f(0)
	elif b <= c:
		f(1)
	else:
		g = gcd(b, d)
		h = a % b
		f(max(((b - h) // g * g + h) % b, b - g) <= c)


import sys

def gcd(x, y):
	(x, y) = sorted([x, y])
	while y % x:
		(y, x) = (x, y % x)
	return x
t = int(sys.stdin.readline())
for _ in range(t):
	(a, b, c, d) = map(int, sys.stdin.readline().split())
	if a < b:
		print('No')
	elif d < b:
		print('No')
	elif c >= b:
		print('Yes')
	else:
		g = gcd(b, d)
		if b - g + a % g > c:
			print('No')
		else:
			print('Yes')


import fractions

def main():
	t = int(input())
	qs = [list(map(int, input().split())) for _ in range(t)]
	for q in qs:
		sub(q)

def sub(q):
	(a, b, c, d) = q
	if d - b < 0:
		print('No')
		return
	if a - b < 0:
		print('No')
		return
	if b > c:
		gcd_bd = fractions.gcd(d, b)
		i = -10
		while True:
			if 0 < gcd_bd * i + (a - c) % gcd_bd < b - c:
				print('No')
				return
			elif gcd_bd * i + (a - c) % gcd_bd >= b - c:
				print('Yes')
				return
			i += 1
	print('Yes')
	return
main()


T = int(input())

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
for _ in range(T):
	(A, B, C, D) = map(int, input().split())
	if A < B:
		print('No')
		continue
	if C < A % B < B:
		print('No')
		continue
	if D % B == 0:
		print('Yes')
		continue
	if D < B:
		print('No')
		continue
	if C + gcd(B, D) < B:
		print('No')
		continue
	print('Yes')


def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)
T = int(input())
for _ in range(T):
	(A, B, C, D) = map(int, input().split())
	if D < B or A < B:
		print('No')
	else:
		g = egcd(B, D)[0]
		mA = A % g
		mC = C % g
		k = C + (mA - mC if mA - mC > 0 else mA - mC + g)
		k -= B
		if k >= 0:
			print('Yes')
		else:
			print('No')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	t = I()
	aa = [LI() for _ in range(t)]
	rr = []
	for (a, b, c, d) in aa:
		if a < b or d < b:
			rr.append('No')
			continue
		if c >= b:
			rr.append('Yes')
			continue
		g = fractions.gcd(b, d)
		if g == 1:
			if b - c > 1:
				rr.append('No')
			else:
				rr.append('Yes')
			continue
		t = (a + d - c) % g
		if t == 0:
			t = g
		if b - c - t > 0:
			rr.append('No')
		else:
			rr.append('Yes')
	return '\n'.join(rr)
print(main())


T = int(input())

def gcd(m, n):
	r = m % n
	return gcd(n, r) if r else n

def check(a, b, c, d):
	if b > a or d < b:
		return 0
	g = gcd(b, d)
	k = (a - c - 1) // g
	p = a - k * g
	if p - b < 0:
		return 0
	return 1
for _ in range(T):
	(a, b, c, d) = map(int, input().split())
	print('Yes' if check(a, b, c, d) else 'No')


import fractions
N = int(input())
x = []
for i in range(N):
	(a1, b1, c1, d1) = [int(i) for i in input().split()]
	x.append([a1, b1, c1, d1])
for i in range(N):
	y = x[i]
	if y[0] < y[1]:
		print('No')
	elif y[1] > y[3]:
		print('No')
	elif y[1] > y[2]:
		ama = y[0] % y[1]
		mo = y[3] % y[1]
		if mo == 0:
			if ama <= y[2]:
				print('Yes')
			else:
				print('No')
		elif mo <= y[1] - y[2] - 1:
			print('No')
		else:
			to = y[1] % mo
			if to == 0:
				if ama <= y[2]:
					print('Yes')
				else:
					print('No')
			else:
				are = fractions.gcd(to, y[1])
				if are - ama % are <= y[1] - y[2] - 1:
					print('No')
				else:
					print('Yes')
	else:
		print('Yes')


gcd = lambda x, y: x if y == 0 else gcd(y, x % y)
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	dx = d % b
	if a < b:
		print('No')
	elif d < b:
		print('No')
	elif c >= b:
		print('Yes')
	elif a % b > c:
		print('No')
	elif dx == 0:
		print('Yes')
	elif b - gcd(b, d) + a % gcd(b, d) > c:
		print('No')
	else:
		print('Yes')


n = int(input())

def gcd(x, y):
	if x % y:
		return gcd(y, x % y)
	else:
		return y
for _ in range(n):
	(a, b, c, d) = (int(i) for i in input().split())
	g = gcd(b, d)
	if a < b or b > d or b - g + a % g > c:
		print('No')
	else:
		print('Yes')


from fractions import *
exec("a,b,c,d=map(int,input().split());g=gcd(b,d);print('YNeos'[b>min(a,d)or b-g+a%g>c::2]);" * int(input()))


from fractions import gcd
(T, *L) = map(int, open(0).read().split())
for (a, b, c, d) in zip(*[iter(L)] * 4):
	if b > d:
		print('No')
	elif b > a:
		print('No')
	elif c >= b:
		print('Yes')
	elif b == d:
		if a % b < c:
			print('Yes')
		else:
			print('No')
	else:
		m = d % b
		n = a % b
		g = gcd(b, d)
		if b - g + a % g > c:
			print('No')
		else:
			print('Yes')


def findGCD(a, b):
	if a % b == 0:
		return b
	else:
		return findGCD(b, a % b)

def judge(a, b, c, d):
	if a < b or d < b:
		return False
	elif c >= b:
		return True
	else:
		g = findGCD(b, d)
		thr = b - g + a % g
		if thr > c:
			return False
		else:
			return True
T = int(input())
ABCD = []
for i in range(T):
	ABCD.append(list(map(int, input().split())))
for (a, b, c, d) in ABCD:
	if judge(a, b, c, d):
		print('Yes')
	else:
		print('No')


from fractions import gcd

def solve(a, b, c, d):
	if a < b or d < b:
		return False
	if c >= b - 1:
		return True
	g = gcd(b, d)
	return b + a % g - g <= c
(T, *L) = map(int, open(0).read().split())
for t in zip(*[iter(L)] * 4):
	if solve(*t):
		print('Yes')
	else:
		print('No')


import fractions

def judge(A, B, C, D):
	if A < B:
		return False
	if D < B:
		return False
	if B <= C:
		return True
	G = fractions.gcd(B, D)
	R = A % G
	if C + G - R - B < 0:
		return False
	else:
		return True
T = int(input())
data = []
for _ in range(T):
	data.append([int(xi) for xi in input().split()])
for (A, B, C, D) in data:
	print('Yes') if judge(A, B, C, D) else print('No')


from fractions import gcd
Q = int(input())
qs = []
for _ in range(Q):
	qs.append(list(map(int, input().split())))
for q in qs:
	(a, b, c, d) = (q[0], q[1], q[2], q[3])
	if a < b or b > d:
		print('No')
	elif b <= c:
		print('Yes')
	elif d % b == 0:
		if a % b > c:
			print('No')
		else:
			print('Yes')
	else:
		a = a % b
		d = d % b
		d = gcd(b, d)
		if a > c:
			print('No')
		elif (a + (c - a) // d * d + d) % b <= c:
			print('Yes')
		else:
			print('No')


from fractions import gcd
T = int(input())
qs = [tuple(map(int, input().split())) for i in range(T)]

def solve(q):
	(a, b, c, d) = q
	if b > d:
		return False
	if a < b:
		return False
	a %= b
	if a > c:
		return False
	if b == d:
		return True
	g = gcd(b, d)
	return b - g <= c
for q in qs:
	print('Yes' if solve(q) else 'No')


import fractions

def isok(a, b, c, d):
	if a < b or b > d:
		print('No')
		return
	g = fractions.gcd(d, b)
	r = (c - a % g) // g * g + a % g
	if r + g - b < 0:
		print('No')
	else:
		print('Yes')
T = int(input())
for _ in range(T):
	(a, b, c, d) = list(map(int, input().split()))
	isok(a, b, c, d)


t = int(input())
import fractions
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	if (b > d) | (a < b):
		print('No')
		continue
	if b <= c:
		print('Yes')
		continue
	c1 = a - (1 + (a - c - 1) // b) * b
	if c1 < 0:
		print('No')
		continue
	mod = fractions.gcd(b, d)
	red = c1 % mod
	for i in [0, 1]:
		tmp = (c // mod + i) * mod + red
		if c < tmp < b:
			print('No')
			break
		if i == 1:
			print('Yes')


import fractions
t = int(input())
al = []
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	if b > d:
		al.append('No')
	elif b > a:
		al.append('No')
	elif b - 1 <= c:
		al.append('Yes')
	elif a % b > c:
		al.append('No')
	else:
		yo = d % b
		now = a % b
		if yo == 0:
			al.append('Yes')
		else:
			g = fractions.gcd(b, yo)
			if c >= b - g + a % g:
				al.append('Yes')
			else:
				al.append('No')
for i in al:
	print(i)


T = int(input())

def gcd(n, m):
	if m == 0:
		return n
	return gcd(m, n % m)
ans = []
for _ in range(T):
	(A, B, C, D) = map(int, input().split())
	if A < B:
		ans.append('No')
		continue
	if B > D:
		ans.append('No')
		continue
	if C >= B:
		ans.append('Yes')
		continue
	G = gcd(D, B)
	maxMod = B - G + A % G
	if C < maxMod:
		ans.append('No')
	else:
		ans.append('Yes')
print(*ans, sep='\n')


import fractions

def solve(a, b, c, d):
	if a < b:
		return False
	if d < b:
		return False
	if b <= c:
		return True
	assert c < b <= min(a, d)
	g = fractions.gcd(b, d)
	return b - g + a % g <= c
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	ans = solve(a, b, c, d)
	print(['No', 'Yes'][ans])


t = int(input())
abcd = [tuple((int(x) for x in input().split())) for _ in range(t)]

def calc_gcd(x, y):
	if x < y:
		(x, y) = (y, x)
	if y == 0:
		return x
	z = x % y
	return calc_gcd(y, z)
for (a, b, c, d) in abcd:
	if b > a or b > d:
		print('No')
		continue
	elif c >= b:
		print('Yes')
		continue
	g = calc_gcd(b, d)
	if b - g + a % g > c:
		print('No')
	else:
		print('Yes')


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
t = int(input())
result = []
for i in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	if b > d:
		result.append('No')
	elif a < b:
		result.append('No')
	elif a % b > c:
		result.append('No')
	elif b - c - 1 < gcd(b, d):
		result.append('Yes')
	else:
		result.append('No')
for r in result:
	print(r)


def gcd(a, b):
	return a if b == 0 else gcd(b, a % b)

def solve(a, b, c, d):
	if a < b or d < b:
		return False
	if b < c:
		return True
	g = gcd(b, d)
	return b + a % g - g <= c
(T, *L) = map(int, open(0).read().split())
print('\n'.join(('Yes' if solve(*t) else 'No' for t in zip(*[iter(L)] * 4))))


import sys
input = sys.stdin.readline
from fractions import gcd

def f(a, b, c, d):
	if a < b:
		return 0
	if b > d:
		return 0
	if b - 1 <= c:
		return 1
	x = a % b
	if b == d:
		if c < x:
			return 0
		elif c >= x:
			return 1
	if c < x:
		return 0
	e = (d - b) % b
	d1 = gcd(e, b)
	q = (c + 1 - x) // d1
	q1 = (b - 1 - x) // d1
	if q < q1:
		return 0
	if (c + 1 - x) % d1 == 0:
		return 0
	return 1
T = int(input())
X = [[int(i) for i in input().split()] for i in range(T)]
for (a, b, c, d) in X:
	s = f(a, b, c, d)
	if s:
		print('Yes')
	else:
		print('No')


from fractions import gcd
(_, *Q) = map(int, open(0).read().split())
for (a, b, c, d) in zip(*[iter(Q)] * 4):
	if a < b or d < b:
		print('No')
		continue
	if c >= b:
		print('Yes')
		continue
	a %= b
	g = gcd(b, d)
	if b - g + a - g * (a // g) > c:
		print('No')
	else:
		print('Yes')


import sys
input = sys.stdin.readline
from fractions import gcd
Q = int(input())
Query = [list(map(int, input().split())) for _ in range(Q)]

def solve(A, B, C, D):
	if A < B or D < B:
		return False
	if C < B - 1:
		if D % B != 0:
			cycle = gcd(D, B)
			if C < B - cycle:
				return False
			if A % cycle < (C + 1) % cycle:
				return True
			else:
				return False
		elif A % B <= C:
			return True
		else:
			return False
	else:
		return True
for (A, B, C, D) in Query:
	ans = 'Yes' if solve(A, B, C, D) else 'No'
	print(ans)


from sys import stdin
from fractions import gcd
columns = int(stdin.readline().rstrip())
datas = [stdin.readline().rstrip().split() for _ in range(columns)]
for data in datas:
	A = int(data[0])
	B = int(data[1])
	C = int(data[2])
	D = int(data[3])
	if A < B:
		print('No')
		continue
	if D < B:
		print('No')
		continue
	if C > B:
		print('Yes')
		continue
	g = gcd(B, D)
	if B - g + A % g > C:
		print('No')
	else:
		print('Yes')


def gcd(a, b):
	return a if b == 0 else gcd(b, a % b)
T = int(input())
for _ in range(T):
	(a, b, c, d) = map(int, input().split())
	if a < b or d < b:
		flag = False
	elif c >= b - 1:
		flag = True
	else:
		g = gcd(b, d)
		flag = b + a % g - g <= c
	if flag:
		print('Yes')
	else:
		print('No')


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
T = int(input())
for i in range(T):
	(A, B, C, D) = map(int, input().split())
	if B > D:
		print('No')
	elif A < B:
		print('No')
	elif C + 1 >= B:
		print('Yes')
	else:
		q = gcd(B, D)
		r = (A - C) % q
		if r == 0:
			r = q
		if C + r >= B:
			print('Yes')
		else:
			print('No')


from bisect import *
from collections import *
from fractions import gcd
from math import factorial
from itertools import *
from heapq import *
import copy
T = int(input())
ABCD = [list(map(int, input().split())) for i in range(T)]
for (A, B, C, D) in ABCD:
	if B > D or A < B:
		print('No')
	elif C >= B:
		print('Yes')
	else:
		F = D - B
		_gcd = gcd(D, B)
		st = (A - B) % _gcd
		if B - _gcd + A % _gcd > C:
			print('No')
		else:
			print('Yes')


from fractions import gcd
T = int(input())
ABCD = [list(map(int, input().split())) for _ in range(T)]
for (a, b, c, d) in ABCD:
	if a < b:
		print('No')
		continue
	if d < b:
		print('No')
		continue
	tmp = a % b
	if tmp > c:
		print('No')
		continue
	if d % b == 0:
		print('Yes')
		continue
	if c >= b - 1:
		print('Yes')
		continue
	if a % 2 == 0 and b % 2 == 0 and (d % 2 == 0) and (b - c == 2):
		print('Yes')
		continue
	GCD = gcd(b, d)
	if b - GCD + a % GCD > c:
		print('No')
	else:
		print('Yes')


from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
INF = float('inf')

def LI():
	return list(map(int, sys.stdin.readline().split()))

def I():
	return int(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return sys.stdin.readline().strip()

def IR(n):
	return [I() for i in range(n)]

def LIR(n):
	return [LI() for i in range(n)]

def SR(n):
	return [S() for i in range(n)]

def LSR(n):
	return [LS() for i in range(n)]

def SRL(n):
	return [list(S()) for i in range(n)]

def MSRL(n):
	return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
t = I()
for i in range(t):
	(a, b, c, d) = LI()
	g = gcd(b, d)
	if b > d or a < b:
		print('No')
	elif c >= b - 1:
		print('Yes')
	elif (a - (b - 1) - 1) // g != (a - (c + 1)) // g:
		print('No')
	else:
		print('Yes')


T = int(input())

def gcd(a, b):
	if a < b:
		(a, b) = (b, a)
	while b:
		(a, b) = (b, a % b)
	return a

def solve(A, B, C, D):
	if A < B:
		return False
	if D < B:
		return False
	if C >= B:
		return True
	s = A % B
	d = D % B
	n = B - C
	if d == 0:
		return s <= C
	else:
		g = gcd(d, B)
		n = (B - 1 - s) // g
		m = s + n * g
		return m <= C
ABCD = [[int(_) for _ in input().split()] for i in range(T)]
for (A, B, C, D) in ABCD:
	if solve(A, B, C, D):
		print('Yes')
	else:
		print('No')


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
T = int(input())
Query = []
for i in range(T):
	Query.append(list(map(int, input().split())))
for i in range(T):
	while True:
		if Query[i][0] % Query[i][1] > Query[i][2] or Query[i][0] < Query[i][1] or Query[i][1] > Query[i][3]:
			print('No')
			break
		G = gcd(Query[i][1], Query[i][3])
		if Query[i][1] - G + Query[i][0] % G > Query[i][2]:
			print('No')
			break
		else:
			print('Yes')
			break


T = int(input())

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
for _ in range(T):
	(a, b, c, d) = list(map(int, input().split()))
	if a < b or d < b:
		print('No')
		continue
	a %= b
	d %= b
	d = gcd(d, b)
	if c >= b:
		print('Yes')
		continue
	x = (b - a) // d
	y = a + x * d
	if y == b:
		y -= d
	if y > c:
		print('No')
	else:
		print('Yes')


import fractions
T = int(input())

def solve(A, B, C, D):
	left = A
	if A < B:
		print('No')
		return
	if D < B:
		print('No')
		return
	if C >= B:
		print('Yes')
		return
	g = fractions.gcd(B, D)
	max_mod_b = B - g + A % g
	if max_mod_b > C:
		print('No')
	else:
		print('Yes')
for _ in range(T):
	(A, B, C, D) = map(int, input().split())
	solve(A, B, C, D)


import fractions
T = int(input())
for i in range(T):
	(a, b, c, d) = map(int, input().split())
	if a < b or d < b:
		print('No')
		continue
	elif b - c < 2:
		print('Yes')
		continue
	elif (a - b) % fractions.gcd(b, d - b) + b - fractions.gcd(b, d - b) > c and (a - b) % fractions.gcd(b, d - b) + b - fractions.gcd(b, d - b) < b:
		print('No')
	else:
		print('Yes')


import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
	from math import gcd

	def judge(a, b, c, d):
		if a - b < 0:
			return False
		else:
			if d - b < 0:
				return False
			first = a - b
			l = c + 1
			r = b - 1
			x = gcd(b, d)
			mod_min = first + (first - l + x - 1) // x * x
			mod_max = first + (r - first) // x * x
			if l <= mod_min <= r or l <= mod_max <= r:
				return False
			else:
				return True
	T = int(readline())
	for _ in range(T):
		(a, b, c, d) = map(int, readline().split())
		print('Yes') if judge(a, b, c, d) else print('No')
main()


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def inpl():
	return [int(i) for i in input().split()]
T = int(input())
for _ in range(T):
	(A, B, C, D) = inpl()
	if A < B or B > D:
		print('No')
		continue
	if C >= B:
		print('Yes')
		continue
	gcdbd = gcd(B, D)
	if (1 + (C - A % B) // gcdbd) * gcdbd + A % B >= B:
		print('Yes')
	else:
		print('No')


import fractions
n = int(input())
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	if b > d or b > a:
		print('No')
	elif b <= c:
		print('Yes')
	else:
		num = fractions.gcd(b, d)
		if b - num + a % num > c:
			print('No')
		else:
			print('Yes')


from fractions import gcd
T = int(input())
for i in range(T):
	(A, B, C, D) = map(int, input().split())
	if B > A:
		print('No')
		continue
	if B > D:
		print('No')
		continue
	if C >= B:
		print('Yes')
		continue
	if B - gcd(B, D) + A % gcd(B, D) <= C:
		print('Yes')
	else:
		print('No')


import sys
iT = int(input())
aR = [[int(x) for x in sLine.split()] for sLine in sys.stdin.readlines()]

def fGcd(iX, iY):
	while iY:
		(iX, iY) = (iY, iX % iY)
	return iX

def fFunc(iA, iB, iC, iD):
	if iA < iB or iD < iB:
		return False
	elif iC >= iB:
		return True
	elif iC < iA % iB:
		return False
	elif iB - iC - 1 < fGcd(iB, iD):
		return True
	else:
		return False
for eR in aR:
	if fFunc(*eR):
		print('Yes')
	else:
		print('No')


import sys

def input():
	return sys.stdin.readline()[:-1]
T = int(input())
from fractions import gcd
for i in range(T):
	(A, B, C, D) = map(int, input().split())
	if A < B or D < B:
		print('No')
		continue
	if B <= C + 1:
		print('Yes')
		continue
	if B == D:
		if A % B <= C:
			print('Yes')
		else:
			print('No')
		continue
	g = gcd(B, D - B)
	if (C - A % g) // g < (B - 1 - A % g) // g:
		print('No')
	else:
		print('Yes')


from fractions import gcd
for _ in range(int(input())):
	(a, b, c, d) = list(map(int, input().split()))
	(k, p) = (b * max((a - c - 1) // b + 1, 1), 0)
	if d < b or a < k:
		p = 1
	elif b < c + 2:
		p = 0
	elif b - c > gcd(b, d):
		p = 1
	print('YNeos'[p::2])


T = int(input())
ABCD = [[int(i) for i in input().split()] for _ in range(T)]

def gcd(a, b):
	(a, b) = (max(a, b), min(a, b))
	while b != 0:
		(a, b) = (b, a % b)
	return a

def solve(A, B, C, D):
	if B > A or B > D:
		return 'No'
	a0 = A % B
	d = gcd(B, D)
	if a0 + ((C - a0) // d + 1) * d >= B:
		return 'Yes'
	return 'No'
for (A, B, C, D) in ABCD:
	print(solve(A, B, C, D))


import math
t = int(input())
abcd = []
for i in range(t):
	abcd.append(list(map(int, input().split())))
for i in range(t):
	if abcd[i][0] < abcd[i][1]:
		print('No')
	elif abcd[i][1] > abcd[i][3]:
		print('No')
	elif abcd[i][3] % abcd[i][1] == 0:
		if abcd[i][0] % abcd[i][1] > abcd[i][2]:
			print('No')
		else:
			print('Yes')
	else:
		(big, small) = (abcd[i][1], abcd[i][3])
		while big % small:
			(big, small) = (small, big % small)
		gcd = small
		if abcd[i][1] - gcd <= abcd[i][2]:
			print('Yes')
		else:
			print('No')


from math import floor

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
T = int(input())
for i in range(T):
	(A, B, C, D) = map(int, input().split())
	if B > D or B > A:
		print('No')
	elif A % B > C:
		print('No')
	else:
		d = gcd(B, D % B)
		r = A % B % d
		if B - d + r > C:
			print('No')
		else:
			print('Yes')


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
t = int(input())
abcd = []
ans = 'No'
for i in range(0, t):
	ABCD = list(map(int, input().split()))
	abcd.append(ABCD)
for (a, b, c, d) in abcd:
	if a >= b and b == d and (b <= c):
		ans = 'Yes'
	if a >= b and d >= b and (b > c) and (b - gcd(d, b) + a % gcd(d, b) <= c):
		ans = 'Yes'
	if a >= b and d >= b and (b <= c):
		ans = 'Yes'
	print(ans)
	ans = 'No'


T = int(input())

def gcd(a: int, b: int) -> int:
	if a < b:
		(a, b) = (b, a)
	return a if b == 0 else gcd(b, a % b)

def lcm(a: int, b: int) -> int:
	return a // gcd(a, b) * b
for i in range(T):
	(A, B, C, D) = map(int, input().split(' '))
	g = gcd(B, D)
	if A < B or D < B:
		print('No')
		continue
	if C >= B - g + A % g:
		print('Yes')
	else:
		print('No')


def examA():
	N = I()
	A = LI()
	ans = 0
	for i in range(N - 1):
		if A[i + 1] == A[i]:
			A[i + 1] = 101
			ans += 1
	print(ans)
	return

def gcd(x, y):
	if y == 0:
		return x
	while y != 0:
		(x, y) = (y, x % y)
	return x

def examB():
	T = I()
	for i in range(T):
		ans = 'Yes'
		(A, B, C, D) = LI()
		if A < B:
			ans = 'No'
		elif D < B:
			ans = 'No'
		elif C >= B:
			print(ans)
			continue
		elif B - C > gcd(D, B):
			ans = 'No'
		if A % B > C:
			ans = 'No'
		print(ans)
	return

def examC():
	N = I()
	S = SI()
	d1 = defaultdict(int)
	d2 = defaultdict(int)
	loop = 2 ** N
	for i in range(loop):
		curR = ''
		curB = ''
		curR2 = ''
		curB2 = ''
		for j in range(N):
			if i & 1 << j == 1 << j:
				curR += S[j]
				curR2 += S[j + N]
			else:
				curB += S[j]
				curB2 += S[j + N]
		d1[curR, curB] += 1
		d2[curR2, curB2] += 1
	ans = 0
	for (key, i) in d1.items():
		cur = i * d2[key[1][::-1], key[0][::-1]]
		ans += cur
	print(ans)
	return
import sys, copy, bisect, itertools, heapq, math
from heapq import heappop, heappush, heapify
from collections import Counter, defaultdict, deque

def I():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LSI():
	return list(map(str, sys.stdin.readline().split()))

def LS():
	return sys.stdin.readline().split()

def SI():
	return sys.stdin.readline().strip()
global mod, inf
mod = 10 ** 9 + 7
inf = 10 ** 18
examB()


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
T = int(input())
for _ in range(T):
	(A, B, C, D) = map(int, input().split())
	if A < B or D < B:
		print('No')
		continue
	elif C + 1 >= B:
		print('Yes')
		continue
	else:
		s_res = A % B
		s_k = int((C + 1 - s_res - 0.1) // B + 1)
		X = gcd(B, D % B)
		if X == 1:
			print('No')
			continue
		else:
			s_0 = s_k * B + s_res
			if (s_0 - (C + 1)) % X > B - C - 2:
				print('Yes')
			else:
				print('No')


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
n = int(input())
for _ in range(n):
	(a, b, c, d) = map(int, input().split())
	if a < b or a % b > c or b > d:
		print('No')
	elif b == d:
		print('Yes')
	elif a % b + d == a:
		print('Yes')
	elif c + gcd(b, d) >= b:
		print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.readline
from fractions import gcd
T = int(input())
ABCD = [[int(x) for x in input().split()] for _ in range(T)]

def F(A, B, C, D):
	if D < B:
		return False
	if A < B:
		return False
	g = gcd(D, B)
	diff = A % g
	A -= diff
	C -= diff
	C -= C % g
	A //= g
	B //= g
	C //= g
	D //= g
	return C + 1 >= B
print('\n'.join(('Yes' if F(a, b, c, d) else 'No' for (a, b, c, d) in ABCD)))


import fractions
T = int(input())
for i in range(T):
	(a, b, c, d) = map(int, input().split())
	if d < b or a < b:
		print('No')
		continue
	if b - 1 <= c:
		print('Yes')
		continue
	gcd = fractions.gcd(d, b)
	e = b - gcd + a % gcd
	if e > c:
		print('No')
	else:
		print('Yes')


def makelist(n, m):
	return [[0 for _ in range(m)] for _ in range(n)]

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
T = int(input())
for turn in range(1, T + 1):
	(init, sell, base, add) = map(int, input().split())
	hoge = gcd(sell, add)
	ans = 'Yes'
	if init < sell or sell > add:
		ans = 'No'
	elif base + hoge >= sell:
		if init % sell > base:
			ans = 'No'
	else:
		ans = 'No'
	print(ans)


t = int(input())
qs = [list(map(int, input().split())) for i in range(t)]

def computeGCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def aprime(a, b, c, d):
	app = a % b
	return c + d - b - (c - app) % (d - b)

def ans(a, b, c, d):
	if d < b or a < b or (a % b > c and c < b):
		return 'No'
	elif b == d or c > b:
		return 'Yes'
	elif aprime(a, b, c, d) < b:
		return 'No'
	else:
		return ans2(aprime(a, b, c, d), b, c, d)

def ans2(a, b, c, d):
	b2 = b % (d - b)
	gcdbbd = abs(computeGCD(b2, b - d))
	aa = a - (a - c) // gcdbbd * gcdbbd
	if aa == c:
		aa = c + gcdbbd
	if aa >= b:
		return 'Yes'
	else:
		return 'No'
for q in qs:
	print(ans(*q))


import fractions
n = int(input())
for _ in range(n):
	(a, b, c, d) = map(int, input().split())
	if d < b:
		print('No')
		continue
	elif a < b:
		print('No')
		continue
	elif c >= b:
		print('Yes')
		continue
	g = fractions.gcd(b, d)
	h = (b - 1 - a % b) // g * g
	if a % b + h > c:
		print('No')
		continue
	print('Yes')


import sys
input = sys.stdin.readline

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def good(a, b, c, d):
	if b > a:
		return 0
	if b > d:
		return 0
	if b <= c:
		return 1
	a %= b
	d %= b
	g = gcd(b, d)
	a += (b - a - 1) // g * g
	return not c < a < b
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	if good(a, b, c, d):
		print('Yes')
	else:
		print('No')


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
T = int(input())
res_list = []
for _ in range(T):
	(A, B, C, D) = map(int, input().split())
	E = gcd(B, D)
	res = 'Yes'
	if A < B:
		res = 'No'
	if D < B:
		res = 'No'
	if C < B - E:
		res = 'No'
	F = A - (A - C - 1) // B * B - B
	if F < 0:
		res = 'No'
	res_list.append(res)
for i in range(T):
	print(res_list[i])


import fractions
T = int(input())
for i in range(T):
	(A, B, C, D) = map(int, input().split())
	if A < B:
		print('No')
		continue
	if B > D:
		print('No')
		continue
	if C >= B - 1:
		print('Yes')
		continue
	A = A % B
	D = D % B
	BD = fractions.gcd(B, D)
	A_max = A + BD * ((B - 1 - A) // BD)
	if A_max > C:
		print('No')
	else:
		print('Yes')


def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
(_, *Q) = map(int, open(0).read().split())
for (a, b, c, d) in zip(*[iter(Q)] * 4):
	if a < b or d < b:
		print('No')
		continue
	if c >= b:
		print('Yes')
		continue
	a %= b
	g = gcd(b, d)
	if b - g + a - g * (a // g) > c:
		print('No')
	else:
		print('Yes')


def g(a, b):
	if a % b == 0:
		return b
	return g(b, a % b)

def f(a, b, c, d):
	yes = 'Yes'
	no = 'No'
	if a < b or d < b:
		return no
	if c >= b or a <= c:
		return yes
	if (a - c) % b > 0 and (a - c) % b < b - c:
		return no
	e = d % b
	if e == 0 or b - c == 1:
		return yes
	if e == 1:
		return no
	h = g(b, e)
	if h < b - c:
		return no
	if (a - c) % h > 0 and (a - c) % h < b - c:
		return no
	return yes
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	ans = f(a, b, c, d)
	print(ans)


import math

def solve(A, B, C, D):
	if A < B or A % B > C:
		return 'No'
	if D < B:
		return 'No'
	if D == B:
		return 'Yes'
	if B <= C + 1:
		return 'Yes'
	g = math.gcd(B, D)
	n = (B - 1 - A % B) // g
	s = A % B + n * g
	if C + 1 <= s <= B - 1:
		return 'No'
	return 'Yes'

def main():
	T = int(input())
	ans = list()
	for _ in range(T):
		(A, B, C, D) = map(int, input().split())
		ans.append(solve(A, B, C, D))
	for a in ans:
		print(a)
main()


import sys
input = sys.stdin.readline
from fractions import gcd

def f(a, b, c, d):
	if a < b:
		return 0
	if b > d:
		return 0
	if b <= c:
		return 1
	x = a % b
	g = gcd(b, d)
	if c >= b - g + x % g:
		return 1
	else:
		return 0
T = int(input())
X = [[int(i) for i in input().split()] for i in range(T)]
for (a, b, c, d) in X:
	s = f(a, b, c, d)
	if s:
		print('Yes')
	else:
		print('No')


import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product

def input():
	return sys.stdin.readline()[:-1]

def ruiseki(lst):
	return [0] + list(accumulate(lst))
sys.setrecursionlimit(500000)
mod = pow(10, 9) + 7
al = [chr(ord('a') + i) for i in range(26)]
direction = [[1, 0], [0, 1], [-1, 0], [0, -1]]
t = int(input())
abcd = [list(map(int, input().split())) for i in range(t)]
for i in range(t):
	(a, b, c, d) = abcd[i]
	if a < b:
		print('No')
	elif d < b:
		print('No')
	elif c >= b:
		print('Yes')
	elif b - math.gcd(b, d) + a % math.gcd(b, d) > c:
		print('No')
	else:
		print('Yes')


def gcd(a, b):
	(a, b) = (max(a, b), min(a, b))
	while a % b != 0:
		(a, b) = (b, a % b)
	return b
T = int(input())
set = []
for i in range(T):
	set.append([int(j) for j in input().split()])
for i in range(T):
	if set[i][0] < set[i][1] or set[i][1] > set[i][3]:
		print('No')
	elif set[i][2] >= set[i][1]:
		print('Yes')
	else:
		g = gcd(set[i][1], set[i][3])
		amodg = set[i][0] % g
		if set[i][1] - g + amodg <= set[i][2]:
			print('Yes')
		else:
			print('No')


def gcd(X0, X1):
	Y0 = max([X0, X1])
	Y1 = min([X0, X1])
	if Y0 % Y1 == 0:
		return Y1
	else:
		return gcd(Y1, Y0 % Y1)

def canbuy(A, B, C, D):
	if B > A:
		return False
	elif B > D:
		return False
	elif C >= B:
		return True
	else:
		g = gcd(B, D)
		X = B - g + A % g
		if X > C:
			return False
		else:
			return True
T = int(input())
S = ['' for i in range(T)]
for i in range(T):
	(a, b, c, d) = map(int, input().split())
	if canbuy(a, b, c, d):
		S[i] = 'Yes'
	else:
		S[i] = 'No'
for i in range(T):
	print(S[i])


import math
N = int(input())
for i in range(N):
	(A, B, C, D) = map(int, input().split())
	if A < B:
		print('No')
		continue
	if B > D:
		print('No')
		continue
	if A % B > C:
		print('No')
		continue
	cycle = D - B
	GCD = math.gcd(B, cycle)
	if GCD == 1 and B - 1 > C:
		print('No')
		continue
	if B - GCD > C:
		print('No')
		continue
	print('Yes')


from fractions import gcd
import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(A, B, C, D) = map(int, input().split())
	if D < B or A < B:
		ans = 'No'
	elif C >= B:
		ans = 'Yes'
	else:
		g = gcd(B, D)
		(lb, ub) = (-10 ** 18, 10 ** 18)
		while ub - lb > 1:
			m = (lb + ub) // 2
			if A - g * m > C:
				lb = m
			else:
				ub = m
		if A - g * lb < B:
			ans = 'No'
		else:
			ans = 'Yes'
	print(ans)


t = int(input())
query = [tuple(map(int, input().split())) for _ in range(t)]

def gcd(x, y):
	if y == 0:
		return x
	return gcd(y, x % y)
for (a, b, c, d) in query:
	g = gcd(b, d)
	r = a % g
	m = ((c - r) // g + 1) * g
	if b <= m and b <= a and (b <= d):
		print('Yes')
	else:
		print('No')


from fractions import gcd
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	if a < b:
		print('No')
		continue
	if d < b:
		print('No')
		continue
	if c >= b - 1:
		print('Yes')
		continue
	if c < a % b:
		print('No')
		continue
	if d % b == 0:
		print('Yes')
		continue
	g = gcd(b, d)
	if c % b < (b - g + a % g) % b:
		print('No')
		continue
	print('Yes')


from fractions import gcd
t = int(input())
abcdt = [list(map(int, input().split())) for _ in range(t)]
for (a, b, c, d) in abcdt:
	if a < b:
		print('No')
	elif d < b:
		print('No')
	else:
		if d - b != 0:
			g = gcd(b, d - b)
		else:
			g = b
		if (a - c - 1) // g >= -(-(a - b + 1) // g):
			print('No')
		else:
			print('Yes')


def gcd(x, y):
	if x < y:
		tmp = y
		y = x
		x = tmp
	while x % y != 0:
		r = x % y
		x = y
		y = r
	return y
n = int(input())
x = []
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	x.append((a, b, c, d))

def f(a, b, c, d):
	if a < b:
		print('No')
	elif b > d:
		print('No')
	elif c >= b:
		print('Yes')
	else:
		g = gcd(b, d)
		if b - g + a % g > c:
			print('No')
		else:
			print('Yes')
for i in range(n):
	(a, b, c, d) = (x[i][0], x[i][1], x[i][2], x[i][3])
	f(a, b, c, d)


import fractions
T = int(input())
for i in range(T):
	(A, B, C, D) = map(int, input().split())
	if A < B:
		print('No')
	elif B > D:
		print('No')
	elif C >= B:
		print('Yes')
	elif A % B > C:
		print('No')
	elif D % B == 0:
		print('Yes')
	else:
		gcdBD = fractions.gcd(B, D)
		if C + gcdBD >= B:
			print('Yes')
		else:
			print('No')


from math import gcd

def solve(a, b, c, d):
	if a < b:
		return False
	if d < b:
		return False
	g = gcd(b, d)
	m = b - (b - a - 1) % g - 1
	return m <= c
T = int(input())
for _ in range(T):
	print('Yes' if solve(*map(int, input().split())) else 'No')


import fractions

def solve(a, b, c, d):
	if a < b or d < b:
		return False
	if b <= c + 1:
		return True
	gcd_bd = fractions.gcd(b, d)
	cc = c - a % gcd_bd
	b //= gcd_bd
	cc //= gcd_bd
	if b <= cc + 1:
		return True
	return False
t = int(input())
buf = []
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	buf.append('Yes' if solve(a, b, c, d) else 'No')
print('\n'.join(map(str, buf)))


T = int(input())
query = [list(map(int, input().split())) for i in range(T)]

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
ans_list = []
for i in range(T):
	A = query[i][0]
	B = query[i][1]
	C = query[i][2]
	D = query[i][3]
	if A < B:
		ans_list.append('No')
		continue
	if B > D:
		ans_list.append('No')
		continue
	if C >= B:
		ans_list.append('Yes')
		continue
	g = gcd(B, D)
	max_modB = B - g + A % g
	if max_modB > C:
		ans_list.append('No')
	else:
		ans_list.append('Yes')
print('\n'.join(ans_list))


import sys
from fractions import gcd

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7

def bisearch_min(mn, mx, func):
	ok = mx
	ng = mn
	while ng + 1 < ok:
		mid = (ok + ng) // 2
		if func(mid):
			ok = mid
		else:
			ng = mid
	return ok

def bisearch_max(mn, mx, func):
	ok = mn
	ng = mx
	while ok + 1 < ng:
		mid = (ok + ng) // 2
		if func(mid):
			ok = mid
		else:
			ng = mid
	return ok
for _ in range(INT()):
	(a, b, c, d) = MAP()
	if a < b or d < b:
		No()
		continue
	g = gcd(b, d)
	mn = bisearch_min(-INF, INF, lambda m: a % g + g * m > c)
	mx = bisearch_max(-INF, INF, lambda m: a % g + g * m < b)
	if mn > mx:
		Yes()
	else:
		No()


import fractions

def run(t, a, b, c, d):
	ret = []
	for i in range(t):
		ret.append(check(a[i], b[i], c[i], d[i]))
	return ret

def check(a, b, c, d):
	if a < b:
		return 'No'
	if d < b:
		return 'No'
	if c < b:
		g = fractions.gcd(b, d)
		amodb = a % b
		if g == 1:
			if b - 1 > c:
				return 'No'
		elif g == b:
			if amodb > c:
				return 'No'
		elif b - g > c:
			return 'No'
	return 'Yes'

def read_line():
	t = int(input())
	a = []
	b = []
	c = []
	d = []
	for i in range(t):
		(at, bt, ct, dt) = list(map(int, input().split()))
		a.append(at)
		b.append(bt)
		c.append(ct)
		d.append(dt)
	return (t, a, b, c, d)

def main():
	(t, a, b, c, d) = read_line()
	ret = run(t, a, b, c, d)
	for i in range(t):
		print(ret[i])
main()


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
for _ in range(int(input())):
	(a, b, c, d) = [int(x) for x in input().split()]
	if a < b:
		print('No')
		continue
	if d < b:
		print('No')
		continue
	if b <= c:
		print('Yes')
		continue
	g = gcd(b, d)
	if c >= b - g + a % g:
		print('Yes')
	else:
		print('No')


import fractions
T = int(input())
L = []
for i in range(0, T):
	L = list(map(int, input().split()))
	A = L[0]
	B = L[1]
	C = L[2]
	D = L[3]
	ans = 'Yes'
	if A < B:
		ans = 'No'
	elif D < B:
		ans = 'No'
	elif B - C <= 1:
		ans = 'Yes'
	elif C < B - fractions.gcd(B, D) + A % fractions.gcd(B, D):
		ans = 'No'
	print(ans)
	L = []


printn = lambda x: print(x, end='')
inn = lambda : int(input())
inl = lambda : list(map(int, input().split()))
inm = lambda : map(int, input().split())
ins = lambda : input().strip()
DBG = True
BIG = 10 ** 18
R = 10 ** 9 + 7

def ddprint(x):
	if DBG:
		print(x)
import fractions
t = inn()
for i in range(t):
	(a, b, c, d) = inm()
	if a < b or d < b:
		print('No')
	else:
		g = fractions.gcd(b, d)
		r = a % g
		q = c % g
		p = c - q + r
		if p <= c:
			p += g
		if p >= b:
			print('Yes')
		else:
			print('No')


def gcd(a, b):
	return a if b == 0 else gcd(b, a % b)

def solve(a, b, c, d):
	if a < b or d < b:
		return False
	if b < c:
		return True
	g = gcd(b, d)
	return b + a % g - g <= c
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	if solve(a, b, c, d):
		print('Yes')
	else:
		print('No')


from fractions import gcd
T = int(input())
for i in range(T):
	(A, B, C, D) = map(int, input().split())
	if B <= A and B <= D:
		if B <= C:
			print('Yes')
		else:
			G = gcd(B, D)
			a = A % G
			t = (C - a) // G + 1
			if B > t * G + a:
				print('No')
			else:
				print('Yes')
	else:
		print('No')


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
T = int(input())
Juice = [None] * T
for i in range(T):
	Juice[i] = list(map(int, input().split()))

def juicecheck(i):
	A = Juice[i][0]
	B = Juice[i][1]
	C = Juice[i][2]
	D = Juice[i][3]
	if A < B:
		print('No')
		return
	elif B > D:
		print('No')
		return
	elif B - 1 <= C:
		print('Yes')
		return
	else:
		x = A % B
		y = D % B
		z = gcd(B, D)
		if z == 1 or B - (C + 1) >= z or (C + 1) % z <= x % z <= (B - 1) % z or ((C + 1) % z > B % z and ((C + 1) % z <= x % z or x % z < B % z)):
			print('No')
			return
		print('Yes')
		return
for i in range(T):
	juicecheck(i)


T = int(input())
ABCD = []
for i in range(T):
	(a, b, c, d) = map(int, input().split())
	ABCD.append((a, b, c, d))
for abcd in ABCD:
	(a, b, c, d) = abcd
	if a < b:
		print('No')
	elif d < b:
		print('No')
	elif c >= b:
		print('Yes')
	else:
		e = a % b
		f = d % b
		list = [a]
		if f == 0:
			if c < e < b:
				print('No')
			else:
				print('Yes')
		else:
			cnt = 0
			while cnt < 100:
				g = ((c - e) // f + 1) * f + e
				if g < b:
					print('No')
					cnt += 10000
				elif g in list:
					print('Yes')
					cnt += 10000
				else:
					list.append(g)
					a = g
					e = a % b
					f = d % b
					cnt += 1


import sys
input = sys.stdin.readline
n = int(input())
C = [list(map(int, input().split())) for i in range(n)]
from fractions import gcd
for i in range(n):
	a = C[i][0]
	b = C[i][1]
	c = C[i][2]
	d = C[i][3]
	ng = 0
	e = 0
	e0 = a - b
	e1 = (c - a % b) // b * b + a % b
	e = min(e0, e1)
	if e < 0 or b > d:
		ng = 1
	else:
		g = gcd(b, d)
		if c + 1 <= b - 1 and (c - e) // g < (b - 1 - e) // g:
			ng = 1
	if ng == 1:
		print('No')
	else:
		print('Yes')