You are given two numbers A and B along with an integer X. In one operation you can do one of the following:
Set A = A + X and B = B - X
Set A = A - X and B = B + X

Determine if you can make A and B equal after applying the operation any number of times (possibly zero).

------ Input Format ------ 

- The first line contains a single integer T — the number of test cases. Then the test cases follow.
- The first and only line of each test case contains two space-separated integers A, B and X — the parameters mentioned in the statement.

------ Output Format ------ 

For each test case, output YES if you can make A and B equal after applying the operation any number of times (possibly zero). Otherwise, output NO.

You can output each letter in any case i.e. YES, yes, yEs are all considered the same.

------ Constraints ------ 

$1 ≤ T ≤ 1000$
$1 ≤ A, B, X ≤ 10^{9}$

----- Sample Input 1 ------ 
4
5 7 1
3 4 2
4 4 6
2 5 3

----- Sample Output 1 ------ 
YES
NO
YES
NO

----- explanation 1 ------ 
Test Case 1: The initial values of $(A, B)$ is $(5, 7)$. We can perform the following operation: $(5,7) \xrightarrow{A = A + X, B = B - X} (6,6)$.

Test Case 2: It can be proven that we can not make $A$ equal to $B$ using the given operations.

Test Case 3: $A$ and $B$ are already equal.

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
for _ in range(int(input())):
	(a, b, x) = map(int, input().split())
	if (a - b) / 2 % x == 0:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	(a, b, c) = map(int, input().split())
	if abs(a - b) % (2 * c) == 0:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(A, B, X) = map(int, input().split())
	if (A - B) / 2 % X == 0:
		print('YES')
		pass
	else:
		print('NO')
		pass
	pass


for u in range(int(input())):
	(x, y, z) = map(int, input().split())
	if (x - y) / 2 % z == 0:
		print('YES')
	else:
		print('NO')


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


for _ in range(int(input())):
	(A, B, X) = map(int, input().split())
	print('YES' if abs(A - B) % (2 * X) == 0 else 'NO')


for i in range(int(input())):
	(a, b, c) = [int(x) for x in input().split()]
	ans = (b - a) / c
	if a == b:
		print('YES')
	elif ans.is_integer() and ans % 2 == 0:
		print('YES')
	else:
		print('NO')


import math
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	if a == b:
		print('YES')
	elif abs((b - a) / 2) % c == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	d = (a - b) / 2
	if d % c == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(x, y, div) = map(int, input().split())
	diff = int(abs(x - y))
	if x == y:
		print('YES')
	elif diff % (2 * div) == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b, x) = map(int, input().split())
	k = max(a, b) - min(a, b)
	if k % (2 * x) == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	(a, b, x) = map(int, input().split())
	if (a - b) / 2 % x == 0:
		print('YES')
	else:
		print('NO')
	t = t - 1


t = int(input())
while t > 0:
	c = input().split()
	(a, b, x) = (int(c[0]), int(c[1]), int(c[2]))
	d = a - b
	if (a - b) % (2 * x) == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


for i in range(int(input())):
	(x, y, k) = map(int, input().split())
	if (x - y) / 2 % k == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	[a, b, x] = list(map(int, input().split()))
	s = a + b
	d = abs(b - a)
	if s % 2 == 0:
		if d % x == 0 and d // x % 2 == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for i in range(int(input())):
	(x, y, a) = map(int, input().split())
	v = (y - x) / 2
	if x == y:
		print('YES')
		continue
	if v != 0 and v % a == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b, x) = map(int, input().split())
	(minimum, maximum) = (min(a, b), max(a, b))
	result = (maximum - minimum) / (2 * x)
	if a == b or result == int(result):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b, x) = map(int, input().split())
	if a == b:
		print('YES')
	elif (a - b) / 2 % x == 0:
		print('YES')
	else:
		print('NO')