Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. 

Chef has a standard chocolate of n by m pieces. More formally, chocolate is a rectangular plate consisting of n rows and m columns. 
Here you can see an example of a standard 5 by 7 chocolate.  

He has two friends and they will play with this chocolate. First friend takes the chocolate and cuts it into two parts by making either a horizontal or vertical cut. Then, the second friend takes one of the available pieces and divides into two parts by either making a horizontal or vertical cut. Then the turn of first friend comes and he can pick any block of the available chocolates and do the same thing again. The player who cannot make a turn loses. 

Now Chef is interested in finding which of his friends will win if both of them play optimally. Output "Yes", if the friend who plays first will win, otherwise print "No".

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

The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
The only line of each test case contains two space separated integers n and m - the sizes of the chocolate.

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

For each test case, output a single line containing one word "Yes" (without quotes) if there is a sequence of moves leading to the winning of the person who moves first and "No" (without quotes) otherwise.

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

$1 ≤ T ≤ 100$
$1 ≤ n, m ≤ 10^{9}$

------ Subtasks ------ 

Subtask #1 (10 points):
$1 ≤ n, m ≤ 10$
Subtask #2 (30 points):
$n = 1 or m = 1$
Subtask #3 (60 points):  No additional constraints

----- Sample Input 1 ------ 
2
1 2
1 3
----- Sample Output 1 ------ 
Yes
No
----- explanation 1 ------ 
Example case 1. There is only one possible move, so the second player even won't have a chance to make move.
Example case 2. There are only two ways first player can make first move, after each of them only one move left, so the first player cannot win.

Source: codechef | Difficulty: EASY
Tags: Constructive algorithms

Mathematics

Ad-hoc


Solutions:
t = int(input())
for ni in range(t):
	(n, m) = map(int, input().split())
	if n * m % 2 == 1:
		print('No')
	else:
		print('Yes')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n * m % 2 == 0:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	(n, m) = map(int, input().split())
	d = n * m
	if d % 2 == 1:
		print('No')
	else:
		print('Yes')


try:
	for _ in range(int(input())):
		(M, N) = map(int, input().split())
		if M * N % 2:
			print('No')
		else:
			print('Yes')
except:
	pass


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a * b % 2:
		print('No')
	else:
		print('Yes')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n % 2 == 1 and m % 2 == 1:
		print('No')
	else:
		print('Yes')


a = int(input(''))
for i in range(a):
	(N, M) = [int(x) for x in input('').split()]
	if N % 2 == 0 or M % 2 == 0:
		print('Yes')
	else:
		print('No')


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


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


for i in range(int(input())):
	(n, m) = [int(x) for x in input().split()]
	if n * m % 2 == 0:
		print('Yes')
	else:
		print('No')


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


t = input()
for c in range(0, int(t)):
	(n, m) = input().split()
	total = int(n) * int(m)
	if total % 2 == 0:
		print('Yes')
	else:
		print('No')


T = int(input())
while T > 0:
	T = T - 1
	(n, m) = map(int, input().split())
	if (n * m - 1) % 2 == 0:
		print('No')
	else:
		print('Yes')


tests = int(input())
for i in range(tests):
	(rows, columns) = map(int, input().split())
	total_cuts = rows - 1 + (columns - 1) * rows
	if rows == 1 and columns == 1:
		print('No')
	elif total_cuts & 1:
		print('Yes')
	else:
		print('No')


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


n = int(input())
testCases = []
for i in range(n):
	testCases.append(list(map(int, input().split())))
for tx in testCases:
	if tx[0] * tx[1] % 2 == 0:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	(n, m) = map(int, input().split())
	if n & 1 == 1 and m & 1 == 1:
		print('No')
	else:
		print('Yes')


def choco(n, m, l):
	if n * m % 2 != 0:
		l.append('No')
	else:
		l.append('Yes')

def casos(t, l):
	cont = 0
	while cont != t:
		(n, m) = map(int, input().split())
		choco(n, m, l)
		cont += 1
l = []
t = int(input(''))
casos(t, l)
for _ in l:
	print(_, end='')
	print()


t = int(input())
while t:
	(n, m) = [int(i) for i in input().split()]
	if n * m % 2 != 0:
		print('No')
	else:
		print('Yes')
	t -= 1


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


for _ in range(int(input(''))):
	(n, m) = map(int, input('').split())
	x = n * m
	if n * m == 1:
		print('No')
	elif x % 2 == 0:
		print('Yes')
	elif x % 2 == 1:
		print('No')


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


for k in range(int(input())):
	(n, m) = map(int, input().split())
	c = n * m
	if c % 2 == 0:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(l, b) = map(int, input().split())
	if l * b % 2 == 0:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(n, m) = [int(x) for x in input().split()]
	pr = n * m
	if pr % 2:
		print('No')
	else:
		print('Yes')


for _ in range(int(input())):
	(row, col) = map(int, input().split())
	if row % 2 == 0 or col % 2 == 0:
		print('Yes')
	else:
		print('No')