A policeman wants to catch a thief. Both the policeman and the thief can only move on a line on integer coordinates between $0$ and $N$ (inclusive).
Initially, the policeman is at a coordinate $x$ and the thief is at a coordinate $y$. During each second, each of them must move to the left or right (not necessarily both in the same direction) by distance $\textbf{exactly}$ equal to $K$. No one may go to the left of the coordinate $0$ or to the right of $N$. Both the policeman and the thief move simultaneously and they cannot meet while moving, only at the end of each second.
Will the policeman be able to catch the thief if they both move optimally? The thief is caught as soon as the policeman and thief meet at the same position at the same time.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first and only line of each test case contains four space-separated integers $x$, $y$, $K$ and $N$.

-----Output-----
For each test case, print a single line containing the string "Yes" if the thief can be caught or "No" if the thief cannot be caught (without quotes).

-----Constraints-----
- $1 \le T \le 1,000$
- $1 \le N \le 10^9$
- $1 \le K \le N$
- $0 \le x, y \le N$
- $x \neq y$

-----Example Input-----
5
0 1 1 1
1 4 1 5
4 2 1 7
3 7 2 10
8 2 3 15

-----Example Output-----
No
No
Yes
Yes
Yes

-----Explanation-----
Example case 1: The policeman is at $0$ and the thief is at $1$. After the $1$-st second, the policeman is at $1$ and the thief is at $0$. After the next second, the policeman is again at $0$ and the thief at $1$. They cannot end up at the same coordinate.

Difficulty: MEDIUM
Tags: Mathematics

Starter code:

Solutions:
for _ in range(int(input())):
	(x, y, k, n) = map(int, input().split())
	if abs(y - x) / k % 2 == 0:
		print('Yes')
	else:
		print('No')


for item in range(int(input())):
	(x, y, K, N) = map(int, input().split())
	c = (y - x) % (2 * K)
	if c == 0:
		print('Yes')
	else:
		print('No')


for p in range(int(input())):
	(x, y, k, n) = [int(a) for a in input().split()]
	if abs(x - y) % (2 * k) == 0:
		print('Yes')
	else:
		print('No')


for forbid in range(int(input())):
	l = input().split()
	(x, y, k, n) = (int(l[0]), int(l[1]), int(l[2]), int(l[3]))
	if abs(x - y) % k == 0 and abs(x - y) / k % 2 == 0:
		print('Yes')
	else:
		print('No')


t = int(input())
while t:
	(x, y, k, n) = map(int, input().split())
	if abs(x - y) % (2 * k) == 0:
		print('Yes')
	else:
		print('No')
	t -= 1


t = int(input())
for _t in range(t):
	(n, m, o, p) = map(int, input().split(' '))
	if abs(n - m) % (2 * o) == 0:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(x, y, k, n) = map(int, input().split())
	if y > x:
		time = (n - y) // k
		yfinal = y + time * k
		xnet = x + time * k
		diff = yfinal - xnet
		if diff % (2 * k) == 0:
			print('Yes')
		else:
			print('No')
	elif x > y:
		time = (y - 0) // k
		yfinal = y - time * k
		xnet = x - time * k
		diff = xnet - yfinal
		if diff % (2 * k) == 0:
			print('Yes')
		else:
			print('No')


t = int(input())
for i in range(t):
	(x, y, k, n) = list(map(int, input().split()))
	val = abs(x - y)
	if val % k == 0:
		if val / k % 2 == 0:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


for t in range(int(input())):
	(x, y, K, N) = [int(i) for i in input().split()]
	if abs(x - y) % K == 0:
		if abs(x - y) // K % 2:
			print('No')
		else:
			print('Yes')
	else:
		print('No')


T = int(input(''))
for i in range(T):
	l1 = [int(c) for c in input('').split()]
	if abs(l1[0] - l1[1]) % (2 * l1[2]) == 0:
		print('Yes')
	else:
		print('No')


try:
	t = int(input())
	while t > 0:
		[x, y, K, N] = [int(x) for x in input().split()]
		if abs(x - y) % (2 * K) == 0:
			print('Yes')
		else:
			print('No')
		t -= 1
except:
	pass


tc = int(input())
while tc > 0:
	tc -= 1
	(x, y, K, N) = map(int, input().split())
	if (x - y) % (2 * K) == 0:
		print('Yes')
	else:
		print('No')


T = int(input())
l = []
for i in range(T):
	(x, y, K, N) = map(int, input().split())
	diff = x - y
	if diff < 0:
		diff = -1 * diff
	if diff % (2 * K) == 0:
		ans = 'Yes'
	else:
		ans = 'No'
	l.append(ans)
for i in l:
	print(i)


for _ in range(int(input())):
	a = [int(i) for i in input().split()]
	if abs(a[0] - a[1]) % (2 * a[2]) == 0:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(x, y, k, n) = [int(x) for x in input().split()]
	a = (y - x) % (2 * k)
	if a == 0:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(a, b, k, n) = map(int, input().split())
	val = abs(a - b)
	if val / k % 2 == 0:
		print('Yes')
	else:
		print('No')


for q in range(int(input())):
	(x, y, k, n) = [int(z) for z in input().split()]
	a = max(x, y)
	b = min(x, y)
	if (a - b) / 2 % k == 0:
		print('Yes')
	else:
		print('No')


T = int(input())
for i in range(T):
	(x, y, k, n) = map(int, input().split())
	d = abs(x - y)
	if d % (2 * k) == 0:
		print('Yes')
	else:
		print('No')


num = int(input())
for i in range(num):
	count = 0
	(x, y, k, n) = map(int, input().split())
	if abs(y - x) % (2 * k) == 0:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	(x, y, k, n) = map(int, input().split())
	a = (y - x) % (2 * k)
	if a == 0:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(x, y, K, N) = map(int, input().split())
	if abs(y - x) % (2 * K) == 0:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	xykn = input().split()
	x = int(xykn[0])
	y = int(xykn[1])
	k = int(xykn[2])
	n = int(xykn[3])
	if abs(x - y) % (2 * k) == 0:
		print('Yes')
	else:
		print('No')


try:
	t = int(input())
	while t:
		(x, y, k, n) = input().split()
		n = int(n)
		k = int(k)
		x = int(x)
		y = int(y)
		if (x - y) % (2 * k) == 0:
			print('Yes')
		else:
			print('No')
		t -= 1
except:
	pass


def readintarray():
	return [int(s) for s in input().strip().split(' ')]

def solve(x, y, k, n):
	if abs(y - x) % k != 0:
		return False
	z = abs(y - x) // k
	return z % 2 == 0
for _ in range(int(input())):
	(x, y, k, n) = readintarray()
	print('Yes' if solve(x, y, k, n) else 'No')


def inparr():
	tmparr = [int(_x) for _x in input().split()]
	return tmparr
for _ in range(int(input())):
	(x, y, K, N) = inparr()
	if abs(x - y) % K == 0:
		if abs(x - y) // K % 2:
			print('No')
		else:
			print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	if abs(l[0] - l[1]) % l[2] != 0:
		print('No')
	elif abs(l[0] - l[1]) // l[2] % 2 == 1:
		print('No')
	else:
		print('Yes')


n = int(input())
for j in range(n):
	(x, y, z, c) = map(int, input().split())
	diff = abs(x - y)
	if z == 1:
		if diff % 2 == 0:
			print('Yes')
		else:
			print('No')
	else:
		n1 = diff // z
		flag = 0
		for i in range(1, n1):
			if x + i * z == y - i * z or x - i * z == y + i * z:
				flag = 1
				break
		if flag == 1:
			print('Yes')
		else:
			print('No ')


t = int(input())
for j in range(t):
	(x, y, K, N) = list(map(int, input().split(' ')))
	val = abs(x - y)
	if val % K == 0:
		if val / K % 2 == 0:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


mod = 1000000007
from sys import stdin, stdout
for _ in range(int(input())):
	(x, y, k, n) = map(int, input().split())
	if abs(x - y) % (2 * k) == 0:
		print('Yes')
	else:
		print('No')


from math import *
import sys

def input():
	return sys.stdin.readline().replace('\n', '').strip()
sys.setrecursionlimit(10 ** 9)
for _ in range(int(input())):
	(x, y, k, n) = list(map(int, input().split()))
	if (y - x) % k == 0 and ((x + y) / 2 - x) % k == 0:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	if abs(b - a) % (2 * c) == 0:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(x, y, k, n) = map(int, input().split())
	ans = 'No'
	if abs(x - y) <= k:
		pass
	elif abs(x - y) % 2 > 0:
		pass
	elif abs(x - y) % (2 * k) == 0:
		ans = 'Yes'
	print(ans)


t = int(input())
while t != 0:
	l = list(map(int, input().split()))
	x = l[0]
	y = l[1]
	k = l[2]
	n = l[3]
	z = abs(x - y)
	if z % (2 * k) == 0:
		print('Yes')
	else:
		print('No')
	t = t - 1