Read problems statements in Mandarin Chinese  and Russian. 

Oh no! Chef’s robot from problem "Reach The Point" (RETPO) has broken up. 
It's old oil tank has got leaked, it is leaking oil now. 

The robot start doing the following weird moves. While moving it keeps leaving a trace of oil on the path it's been tracing.

Note that in a single step robot will move by one unit in the current direction it is moving.

Initially the robot is at position (0, 0).
In the beginning it goes 1 step to the East (i.e. In a single step, its x coordinate will increase by 1 unit.)  
then 2 steps to the North, (i.e. In a single step, its y coordinate will increase by 1 unit.) 
then 3 steps to the West, (i.e. In a single step, its x coordinate will decrease by 1 unit.)
then 4 steps to the South, (i.e. In a single step, its y coordinate will decrease by 1 unit.)
then 5 steps to the East, 
and so on.
 
Thus each time the robot turns 90 degrees anti clockwise, and it will go one more step than before. Please view the following image to 
understand the moves. The red line in the example shows the path traced by the robot having traces of oil on it.

Now chef wants to know whether the point (X, Y) will have traces of oil on it or not. 

------ Input ------ 

The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.

For each test case, there is a single line containing two space-separated integers X and Y.

------ Output ------ 

For each test case, output a single line containing “YES” (without quotes) if robot will reach point (X, Y) and “NO” otherwise.

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

$1 ≤ T ≤ 100000 = 10^{5}$
$-1000000000 ≤ X, Y ≤ 1000000000, i.e., -10^{9} ≤ X, Y ≤ 10^{9}$

----- Sample Input 1 ------ 
3
3 3
3 5
0 0
----- Sample Output 1 ------ 
YES
NO
YES
----- explanation 1 ------ 

The points (0, 0) and (3, 3) will be having trace of oil while point (3, 5) will not have any trace of oil because point (3, 5) does not lie on the trajectory of robot.

Difficulty: MEDIUM
Tags: Constructive algorithms

Ad-hoc

Starter code:

Solutions:
(ii, uu) = (0, 1)
ss = 1000
for _ in range(int(input())):
	(a, x) = map(int, input().split())
	if a == 0 and x == 0:
		print('YES')
	elif a < 0 and x <= -a and (x >= a) and (a % 2 == 0):
		print('YES')
	elif x > 0 and x >= a + 1 and (-x <= a) and (x % 2 == 0):
		print('YES')
	elif a > 0 and x <= a + 1 and (x >= 1 - a) and (a % 2 == 1):
		print('YES')
	elif x < 0 and a >= x and (x <= 1 - a) and (x % 2 == 0):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if x == 0 and y == 0:
		print('YES')
	elif x < 0 and y <= -x and (y >= x) and (x % 2 == 0):
		print('YES')
	elif y > 0 and y >= x + 1 and (-y <= x) and (y % 2 == 0):
		print('YES')
	elif x > 0 and y <= x + 1 and (y >= 1 - x) and (x % 2 == 1):
		print('YES')
	elif y < 0 and x >= y and (y <= 1 - x) and (y % 2 == 0):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	bl = False
	if x > 0:
		if x % 2 != 0 and -1 * (x - 1) <= y <= x + 1:
			bl = True
		elif y % 2 == 0:
			if y >= 0 and x <= y - 1:
				bl = True
			elif y < 0:
				if x <= abs(y) + 1:
					bl = True
	elif x % 2 == 0 and abs(y) <= abs(x):
		bl = True
	elif y % 2 == 0:
		if y == 0 and x == -1:
			pass
		elif abs(x) <= abs(y):
			bl = True
	if bl:
		print('YES')
	else:
		print('NO')


tests = int(input())
for i in range(tests):
	(x, y) = map(int, input().split())
	ans = 'NO'
	if x == 0 and y == 0:
		ans = 'YES'
	elif x >= 0 and y >= 0:
		if x & 1 and y <= x + 1:
			ans = 'YES'
		if y % 2 == 0 and x <= y - 1:
			ans = 'YES'
	elif x <= 0 and y >= 0 or (x <= 0 and y <= 0):
		if x % 2 == 0 and abs(y) <= abs(x):
			ans = 'YES'
		if y % 2 == 0 and abs(x) <= abs(y):
			ans = 'YES'
	elif x >= 0 and y <= 0:
		if x & 1 and abs(y) <= x - 1:
			ans = 'YES'
		if y % 2 == 0 and x <= abs(y) + 1:
			ans = 'YES'
	print(ans)


tsc = int(input())
for i in range(0, tsc):
	string = input()
	string = string.split()
	x = int(string[0])
	y = int(string[1])
	if x >= 0:
		if x % 2 == 1 and abs(y) % 2 == 0:
			print('YES')
		elif x % 2 == 1 and abs(y) % 2 == 1:
			print('YES') if y <= x + 1 and y >= 1 - x else print('NO')
		elif x % 2 == 0 and abs(y) % 2 == 0:
			print('YES') if y > x or y <= -x else print('NO')
		else:
			print('NO')
	elif x < 0:
		if abs(x) % 2 == 0 and abs(y) % 2 == 0:
			print('YES')
		elif abs(x) % 2 == 0 and abs(y) % 2 == 1:
			print('YES') if abs(y) <= abs(x) else print('NO')
		elif abs(x) % 2 == 1 and abs(y) % 2 == 0:
			print('YES') if abs(y) > abs(x) else print('NO')
		else:
			print('NO')


for i in range(int(input())):
	st = input().split()
	X = int(st[0])
	Y = int(st[1])
	valid = False
	if abs(Y) % 2 == 0:
		if Y > 0:
			x1 = -Y
			x2 = Y - 1
			if X >= x1 and X <= x2:
				valid = True
		else:
			x1 = Y
			x2 = abs(Y) + 1
			if X >= x1 and X <= x2:
				valid = True
	if X > 0 and X % 2 == 1:
		y1 = 1 - X
		y2 = X + 1
		if Y >= y1 and Y <= y2:
			valid = True
	if X < 0 and X % 2 == 0:
		y1 = X
		y2 = -X
		if Y >= y1 and Y <= y2:
			valid = True
	if valid:
		print('YES')
	else:
		print('NO')


t = int(input())
for T in range(t):
	(x, y) = [int(x) for x in input().split()]
	if x > 0 and x % 2 == 1 and (y > -x + 1) and (y <= x + 1):
		print('YES')
	elif x < 0 and x % 2 == 0 and (y >= x) and (y <= -x):
		print('YES')
	elif y > 0 and y % 2 == 0 and (x >= -y) and (x < y):
		print('YES')
	elif y <= 0 and y % 2 == 0 and (x >= y) and (x <= -y + 1):
		print('YES')
	else:
		print('NO')


for __ in range(int(input())):
	(X, Y) = list(map(int, input().split()))
	num = -1
	if Y > 0:
		num *= -1
	if Y == 0:
		if X > 0 and X % 2 == 1 or (X <= 0 and X % 2 == 0):
			print('YES')
			continue
	elif X >= 0:
		if abs(Y) > X and Y % 2 == 0 or (X % 2 == 1 and -X - num <= Y <= X + num):
			print('YES')
			continue
		elif abs(Y) == X and Y % 2 == 0 and (Y < 0):
			print('YES')
			continue
	elif X < 0:
		if abs(Y) >= -X and Y % 2 == 0 or (X % 2 == 0 and X <= Y <= -X):
			print('YES')
			continue
	print('NO')


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	if x == 0 and y == 0:
		print('YES')
	elif x >= 0 and y >= 0:
		z = (x - 1) / 2 + 1
		v = (y - 2) / 2 + 1
		if int(z) == z and int(v) != v:
			ha = 2 + (z - 1) * 2
			if y <= ha:
				print('YES')
			else:
				print('NO')
		elif v == int(v) and int(z) != z:
			ha = 1 + (v - 1) * 2
			if x <= ha:
				print('YES')
			else:
				print('NO')
		elif v == int(v) and int(z) == z:
			print('YES')
		else:
			print('NO')
	elif x >= 0 and y <= 0:
		z = (x - 1) / 2 + 1
		v = (y + 2) / -2 + 1
		if int(z) == z and int(v) != v:
			ha = -2 + (z - 2) * -2
			if y >= ha:
				print('YES')
			else:
				print('NO')
		elif v == int(v) and int(z) != z:
			ha = 1 + v * 2
			if x <= ha:
				print('YES')
			else:
				print('NO')
		elif v == int(v) and int(z) == z:
			print('YES')
		else:
			print('NO')
	elif y >= 0 and x <= 0:
		z = (x + 2) / -2 + 1
		v = (y - 2) / 2 + 1
		if int(z) == z and int(v) != v:
			ha = 2 + (z - 1) * 2
			if y <= ha:
				print('YES')
			else:
				print('NO')
		elif v == int(v) and int(z) != z:
			ha = -2 + (v - 1) * -2
			if x >= ha:
				print('YES')
			else:
				print('NO')
		elif v == int(v) and int(z) == z:
			print('YES')
		else:
			print('NO')
	else:
		z = (x + 2) / -2 + 1
		v = (y + 2) / -2 + 1
		if int(z) == z and int(v) != v:
			ha = -2 + (z - 1) * -2
			if y >= ha:
				print('YES')
			else:
				print('NO')
		elif v == int(v) and int(z) != z:
			ha = -2 + (v - 1) * -2
			if x >= ha:
				print('YES')
			else:
				print('NO')
		elif v == int(v) and int(z) == z:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	a = input()
	(x, y) = (int(a.split()[0]), int(a.split()[1]))
	if x == 0 and y == 0:
		print('YES')
	elif x % 2 == 0 and (y >= x and y <= -x) and (x <= 0):
		print('YES')
	elif x % 2 == 1 and (y >= -x + 1 and y <= x + 1) and (x >= 0):
		print('YES')
	elif y % 2 == 0 and (x <= y - 1 and x >= -y and (y >= 0) or (x >= y and x <= -y + 1 and (y <= 0))):
		print('YES')
	else:
		print('NO')


for __ in range(int(input())):
	(X, Y) = list(map(int, input().split()))
	if X == 0 and Y == 0:
		print('YES')
	elif X >= 0 and X % 2 == 0:
		if Y % 2 == 0:
			if Y < 0 and abs(Y) >= abs(X):
				print('YES')
			elif Y > 0 and abs(Y) > abs(X):
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	elif X < 0 and X % 2 != 0:
		if Y % 2 == 0:
			if Y < 0 and abs(Y) >= abs(X):
				print('YES')
			elif Y > 0 and abs(Y) > abs(X):
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	elif X > 0 and X % 2 != 0:
		if (X - 1) * -1 <= Y <= X + 1:
			print('YES')
		elif Y % 2 == 0:
			if Y < 0 and abs(Y) >= abs(X):
				print('YES')
			elif Y > 0 and abs(Y) > abs(X):
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	elif X < 0 and X % 2 == 0:
		if X <= Y <= X * -1:
			print('YES')
		elif Y % 2 == 0 and abs(Y) >= abs(X):
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	z = input().split()
	(x, y) = map(int, z[:2])
	if x > 0:
		x += 1
		if y < 0:
			y -= 2
	d = max(abs(x), abs(y))
	print('YES' if d % 2 == 0 else 'NO')


def hcheck(x, y):
	if y > 0:
		if y % 2 == 0:
			ulimit = y - 1
			llimit = -y
			if x >= llimit and x <= ulimit:
				return True
			else:
				return False
		else:
			return False
	else:
		y = -y
		if y % 2 == 0:
			ulimit = y + 1
			llimit = -y
			if x >= llimit and x <= ulimit:
				return True
			else:
				return False
		else:
			return False

def vcheck(x, y):
	if x > 0:
		if (x + 1) % 2 == 0:
			ulimit = x + 1
			llimit = -(x - 1)
			if y >= llimit and y <= ulimit:
				return True
			else:
				return False
		else:
			return False
	else:
		x = -x
		if x % 2 == 0:
			ulimit = x
			llimit = -x
			if y >= llimit and y <= ulimit:
				return True
			else:
				return False
		else:
			return False

def fcheck(x, y):
	if (x, y) in [(0, 0), (1, 0), (1, 1)]:
		return True
	return hcheck(x, y) or vcheck(x, y)
lmap = lambda x: 'YES' if x else 'NO'
for _ in range(int(input())):
	(x, y) = [int(i) for i in input().split()]
	print(lmap(fcheck(x, y)))


for t in range(int(input())):
	temp = list(map(int, input().split()))
	x = temp[0]
	y = temp[1]
	if x == 0 and y == 0:
		print('YES')
	elif x == 0:
		if y % 2 == 0:
			print('YES')
		else:
			print('NO')
	elif y == 0:
		if x < 0 and x % 2 == 0:
			print('YES')
		elif x > 0 and x % 2 == 1:
			print('YES')
		else:
			print('NO')
	elif x > 0 and x % 2 == 1:
		lb = -(x - 1)
		ub = x + 1
		if y >= lb and y <= ub or y % 2 == 0:
			print('YES')
		else:
			print('NO')
	elif x < 0 and x % 2 == 0:
		lb = x
		ub = -x
		if y >= lb and y <= ub or y % 2 == 0:
			print('YES')
		else:
			print('NO')
	elif x > 0:
		if y % 2 == 0:
			if y < 0 and y <= -x:
				print('YES')
			elif y > 0 and y >= x + 2:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	elif x < 0:
		if y % 2 == 0:
			if y < 0 and y <= x - 1:
				print('YES')
			elif y > 0 and y >= -x + 1:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')


def hor(x, y):
	if y % 2 == 1:
		return False
	return y <= 0 and y <= x <= -y + 1 or (y > 0 and -y <= x <= y - 1)

def ver(x, y):
	if x < 0 and x % 2 == 1 or (x > 0 and x % 2 == 0):
		return False
	return x <= 0 and x <= y <= -x or (x > 0 and -x + 1 <= y <= x + 1)
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if hor(x, y) or ver(x, y):
		print('YES')
	else:
		print('NO')


def fromX(x, y):
	if x % 2 == 0 and x > 0 or (x % 2 == 1 and x < 0):
		return False
	if x % 2 == 0:
		return x <= y <= -x
	else:
		return -x + 1 <= y <= x + 1

def fromY(x, y):
	if y % 2 == 1:
		return False
	if y <= 0:
		return y <= x <= -y + 1
	else:
		return -y <= x <= y - 1
T = int(input())
for i in range(T):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	if fromX(x, y) or fromY(x, y):
		print('YES')
	else:
		print('NO')


for __ in range(int(input())):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	f = 0
	if x == 0 and y == 0:
		f = 1
	elif x >= 0 and y >= 0:
		if x % 2 != 0 and y <= x + 1:
			f = 1
		elif y % 2 == 0 and x <= y - 1:
			f = 1
	elif x <= 0 and y >= 0:
		if x % 2 == 0 and y <= -x:
			f = 1
		elif y % 2 == 0 and x >= -y:
			f = 1
	elif x <= 0 and y <= 0:
		if x % 2 == 0 and y >= x:
			f = 1
		elif y % 2 == 0 and x >= y:
			f = 1
	elif x >= 0 and y <= 0:
		if x % 2 != 0 and y >= -(x - 1):
			f = 1
		elif y % 2 == 0 and x <= -(y - 1):
			f = 1
	if f == 1:
		print('YES')
	else:
		print('NO')


import math

def checkX(x, y):
	if abs(x) * (-1) ** (abs(x) + 1) != x:
		return False
	if x % 2 == 0:
		return x <= y <= -x
	else:
		return -x + 1 <= y <= x + 1

def checkY(x, y):
	if abs(y) % 2:
		return False
	if y > 0:
		return -y <= x <= y - 1
	else:
		return y <= x <= -y + 1

def check(x, y):
	return checkX(x, y) or checkY(x, y)
t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	print('YES' if check(x, y) else 'NO')


t = int(input())
for j in range(t):
	flag = 0
	(x, y) = map(int, input().split(' '))
	if x >= 0:
		if x % 2 == 0:
			if y == 2 + x or y == -x:
				flag = 1
		elif y >= -x + 1 and y <= x + 1:
			flag = 1
	if x < 0:
		if x % 2 != 0:
			if y == -(-x + 1) or y == -x + 1:
				flag = 1
		elif y >= x and y <= -x:
			flag = 1
	if y > 0:
		if y % 2 != 0:
			if x == -(y + 1) or x == y:
				flag = 1
		elif x >= -y and x <= y - 1:
			flag = 1
	if y < 0:
		if y % 2 != 0:
			if x == y - 1 or x == -y + 2:
				flag = 1
		elif x >= y and x <= -y + 1:
			flag = 1
	if flag == 1:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	temp = input().split()
	X = int(temp[0])
	Y = int(temp[1])
	flag = False
	if Y > 0:
		if Y % 2 == 0:
			if X >= -Y and X <= Y - 1:
				flag = True
	elif abs(Y) % 2 == 0:
		if X >= Y and X <= -Y + 1:
			flag = True
	if X > 0:
		if X % 2 == 1:
			if Y >= -X + 1 and Y <= X + 1:
				flag = True
	elif abs(X) % 2 == 0:
		if Y >= X and Y <= abs(X):
			flag = True
	if flag:
		print('YES')
	else:
		print('NO')


def read_inps():
	arr = input('').split()
	x = int(arr[0])
	y = int(arr[1])
	return (x, y)

def solve_for(x, y):
	if x == 0:
		if y % 2 == 0:
			return 'YES'
		else:
			return 'NO'
	if y == 0:
		if x > 0 and x % 2 == 1 or (x < 0 and x % 2 == 0):
			return 'YES'
		else:
			return 'NO'
	if x > 0:
		if y > 0:
			if x % 2 == 1:
				if y <= x + 1 or (y % 2 == 0 and y > x + 1):
					return 'YES'
				else:
					return 'NO'
			elif y % 2 == 0 and y > x + 1:
				return 'YES'
			else:
				return 'NO'
		elif x % 2 == 1:
			if abs(y) < x or (y % 2 == 0 and abs(y) > x):
				return 'YES'
			else:
				return 'NO'
		elif y % 2 == 0 and abs(y) >= x:
			return 'YES'
		else:
			return 'NO'
	elif y > 0:
		if x % 2 == 0:
			if y % 2 == 0 or y <= abs(x):
				return 'YES'
			else:
				return 'NO'
		elif y % 2 == 0 and y > abs(x):
			return 'YES'
		else:
			return 'NO'
	elif x % 2 == 0:
		if abs(y) <= abs(x):
			return 'YES'
		elif abs(y) > abs(x) and y % 2 == 0:
			return 'YES'
		else:
			return 'NO'
	elif y % 2 == 0 and abs(y) > abs(x):
		return 'YES'
	else:
		return 'NO'

def my_assert(exp, inp):
	if exp != solve_for(inp[0], inp[1]):
		print('Failed for (' + str(inp[0]) + ', ' + str(inp[1]) + ')')
T = int(input())
for i in range(T):
	ins = read_inps()
	print(solve_for(ins[0], ins[1]))


import sys

def main():
	cases = int(input())
	for t in range(0, cases):
		goal = [int(x) for x in input().split()]
		x = goal[0]
		y = goal[1]
		if y == 0 and x == 0:
			print('YES')
			continue
		if x == 1 and y == 0:
			print('YES')
			continue
		if x == 0 and abs(y) % 2 == 0:
			print('YES')
			continue
		if y == 0:
			if x > 0:
				if x % 2 == 1:
					print('YES')
					continue
			elif x % 2 == 0:
				print('YES')
				continue
		if x < 0:
			if x % 2 == 0:
				if abs(y) <= abs(x):
					print('YES')
					continue
			elif y % 2 == 0:
				if y <= 0:
					if abs(x) <= abs(y):
						print('YES')
						continue
				elif abs(x) <= y:
					print('YES')
					continue
		elif x % 2 == 1:
			if y > 0:
				if y <= abs(x) + 1:
					print('YES')
					continue
			elif abs(y) < abs(x):
				print('YES')
				continue
		elif y % 2 == 0:
			if y >= 0:
				if x < y:
					print('YES')
					continue
			elif x <= abs(y) + 1:
				print('YES')
				continue
		if y < 0:
			if y % 2 == 0:
				if x <= 0:
					if abs(x) <= abs(y):
						print('YES')
						continue
				elif x <= abs(y) + 1:
					print('YES')
					continue
		elif y % 2 == 0:
			if x >= 0:
				if x < y:
					print('YES')
					continue
			elif abs(x) <= y:
				print('YES')
				continue
		print('NO')
main()


a = int(input())
for z in range(0, a):
	p = input()
	p = p.split(' ')
	x = float(p[0])
	y = float(p[1])
	r = 0
	if x > 0 and x % 2 == 1:
		if y >= -1 * x + 1 and y <= x + 1:
			r = 1
	if x < 0 and x % 2 == 0:
		if y >= x + 1 and y <= -1 * x:
			r = 1
	if y > 0 and y % 2 == 0:
		if x <= y - 1 and x >= -1 * y:
			r = 1
	if y < 0 and y % 2 == 0:
		if x <= -1 * y + 1 and x >= y:
			r = 1
	if y == 0 and (x >= 0 and x <= 1):
		r = 1
	if r == 1:
		print('YES')
	else:
		print('NO')


t = int(input())

def good0(x, y):
	if y > 0 or y % 2 != 0:
		return False
	(low, high) = (y, -y + 1)
	return low <= x <= high

def good1(x, y):
	if x <= 0 or x % 2 != 1:
		return False
	(low, high) = (-x + 1, x)
	return low <= y <= high

def good2(x, y):
	if y <= 0 or y % 2 != 0:
		return False
	(low, high) = (-y, y - 1)
	return low <= x <= high

def good3(x, y):
	if x >= 0 or x % 2 != 0:
		return False
	(low, high) = (x, -x)
	return low <= y <= high

def good(x, y):
	return good0(x, y) or good1(x, y) or good2(x, y) or good3(x, y)
for _ in range(t):
	print('YES' if good(*map(int, input().split())) else 'NO')


runs = int(input())
for run in range(runs):
	point = input().split()
	x = int(point[0])
	y = int(point[1])
	on = False
	if x > 0 and x % 2 == 1 and (abs(y - 1) <= abs(x)):
		on = True
	if x < 0 and x % 2 == 0 and (abs(y) <= abs(x)):
		on = True
	if y % 2 == 0:
		if y > 0 and abs(2 * x + 1) <= abs(2 * y - 1):
			on = True
		if y < 0 and abs(2 * x - 1) <= abs(2 * y - 1):
			on = True
		if y == 0 and (x == 0 or x == 1):
			on = True
	if on:
		print('YES')
	else:
		print('NO')


def yn(a, b):
	if b % 2 == 0:
		if b <= 0:
			lowbd = b
			rightbd = -b + 1
			if lowbd <= a and a <= rightbd:
				return True
		if b > 0:
			lowbd = -b
			rightbd = b - 1
			if lowbd <= a and a <= rightbd:
				return True
	if a % 2 == 0 and a < 0:
		lowbd = a
		rightbd = -a
		if lowbd <= b and b <= rightbd:
			return True
	if a % 2 == 1 and a > 0:
		lowbd = -(a - 1)
		rightbd = a + 1
		if lowbd <= b and b <= rightbd:
			return True
	return False
tcs = int(input())
for tc in range(tcs):
	(a, b) = map(int, input().split(' '))
	if yn(a, b):
		print('YES')
	else:
		print('NO')


import sys
for _ in range(int(sys.stdin.readline())):
	(x, y) = [int(z) for z in sys.stdin.readline().split()]
	if abs(x) == abs(y):
		if x == 0:
			print('YES')
		elif x > 0 and y > 0:
			if y % 2 != 0:
				print('YES')
			else:
				print('NO')
		elif abs(y) % 2 == 0:
			print('YES')
		else:
			print('NO')
	elif abs(x) % 2 == 0:
		if x > 0 and y > 0:
			if y > x + 1 and y % 2 == 0:
				print('YES')
			else:
				print('NO')
		elif x < 0:
			if abs(y) <= abs(x) or (abs(y) > abs(x) and abs(y) % 2 == 0):
				print('YES')
			else:
				print('NO')
		elif abs(y) >= abs(x) and abs(y) % 2 == 0:
			print('YES')
		else:
			print('NO')
	elif x > 0 and y > 0:
		if y <= x or (y > x and y % 2 == 0):
			print('YES')
		else:
			print('NO')
	elif x < 0:
		if abs(y) > abs(x) and abs(y) % 2 == 0:
			print('YES')
		else:
			print('NO')
	elif abs(y) <= abs(x) or (abs(y) > abs(x) and abs(y) % 2 == 0):
		print('YES')
	else:
		print('NO')


def isGood(x, y):
	modx = x % 2
	mody = y % 2
	if mody == 0 and (x <= 0 and modx == 0 or (x > 0 and modx == 1) or (x >= -abs(y) and x < abs(y - 1) + 1)):
		return 'YES'
	elif mody == 1 and (x > 0 and modx == 1 and (y >= 2 - x) and (y < x + 1) or (x < 0 and modx == 0 and (y >= x + 1) and (y < -x))):
		return 'YES'
	return 'NO'
t = int(input())
ret = ''
while t > 0:
	(x, y) = [int(i) for i in input().split()]
	ret += isGood(x, y) + '\n'
	t -= 1
print(ret[:-1])


def solve(X, Y):
	if Y <= 0 and Y % 2 == 0 and (Y <= X) and (X <= -Y + 1):
		return True
	if X > 0 and X % 2 == 1 and (-X + 1 <= Y) and (Y <= X + 1):
		return True
	if Y > 0 and Y % 2 == 0 and (-Y <= X) and (X <= Y - 1):
		return True
	return X < 0 and X % 2 == 0 and (X <= Y) and (Y <= -X)
T = int(input())
for t in range(T):
	(X, Y) = map(int, input().split())
	print('YES' if solve(X, Y) else 'NO')


i = int(input())
while i:
	a = [int(j) for j in input().split()]
	x = a[0]
	y = a[1]
	if y <= 0 and abs(y) % 2 == 0 and (x >= -abs(y)) and (x <= 1 + abs(y)):
		print('YES')
	elif y > 0 and abs(y) % 2 == 0 and (x >= -abs(y)) and (x <= abs(y) - 1):
		print('YES')
	elif x > 0 and x % 2 == 1 and (y >= -x + 1) and (y <= x + 1):
		print('YES')
	elif x < 0 and abs(x) % 2 == 0 and (y >= -abs(x)) and (y <= abs(x)):
		print('YES')
	else:
		print('NO')
	i -= 1


T = int(input())
x = [0] * T
y = [0] * T
for i in range(0, T):
	s = input().split()
	x[i] = int(s[0])
	y[i] = int(s[1])
for i in range(0, T):
	if x[i] == 0 and y[i] == 0:
		print('YES')
	elif x[i] > 0 and y[i] >= 1 - x[i] and (y[i] <= 1 + x[i]) and (x[i] % 2 != 0) or (x[i] < 0 and y[i] <= -x[i] and (y[i] >= x[i]) and (x[i] % 2 == 0)) or (y[i] > 0 and x[i] >= -y[i] and (x[i] <= y[i] - 1) and (y[i] % 2 == 0)) or (y[i] < 0 and x[i] >= y[i] and (x[i] <= 1 - y[i]) and (y[i] % 2 == 0)):
		print('YES')
	else:
		print('NO')