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

Chef is stuck in a two dimensional maze having N rows and M columns. He needs to get out of the maze as soon as possible and arrive at the kitchen in order to serve his hungry customers. But, he can get out of the maze only if he is able to successfully find any magical path in the given maze.

A path is defined as magical if it starts from any of the cell (a,b) of the maze and ends at the cell (c,d) such that the following conditions are satisfied :-

|a - c| + |b - d| = 1
All the cells in the maze are traversed exactly once.
It is allowed to move only in the four directions - up, down, left and right from the current cell.

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

First line of the input contains an integer T denoting the number of different types of scenarios.
Each of the next T lines will contain two integers N, M denoting the dimensions of the maze.

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

For each of the T scenarios, output a single line containing "Yes" or "No" (without quotes) denoting whether the Chef can get out of the maze or not.

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

1 ≤ T ≤ 10^{5}
1 ≤ N, M ≤ 10^{18}

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

Subtask #1 : (30 points)

1 ≤ T ≤ 100
1 ≤ N, M ≤ 10

Subtask #2 : (70 points) 

Original Constraints

----- Sample Input 1 ------ 
1
2 2
----- Sample Output 1 ------ 
Yes
----- explanation 1 ------ 
Example case 1.
Chef can start from (1,1), move down to (2,1), then move right to (2,2) and finally move upwards to reach (1,2). As, he is able to visit all the cells exactly once and sum of absolute differences of corresponding x and y dimension is 1, we can call this path a magical path.

Source: codechef | Difficulty: MEDIUM
Tags: Paths and circuits


Solutions:
def check(n, m):
	if n == 1 and m == 2 or (n == 2 and m == 1):
		return True
	if n == 1 or m == 1:
		return False
	if n * m % 2 == 0:
		return True
	else:
		return False
case = int(input())
for i in range(case):
	(n, m) = map(int, input().split(' '))
	res = check(n, m)
	if res:
		print('Yes')
	else:
		print('No')


for a in range(int(input())):
	(N, M) = map(int, input().split())
	if min(N, M) >= 2:
		if M % 2 == 0 or N % 2 == 0:
			print('Yes')
		else:
			print('No')
	elif min(M, N) == 1 and max(M, N) == 2:
		print('Yes')
	else:
		print('No')


for tc in range(int(input())):
	(n, m) = map(int, input().split())
	if min(n, m) >= 2:
		if m % 2 == 0 or n % 2 == 0:
			print('Yes')
		else:
			print('No')
	elif min(m, n) == 1 and max(m, n) == 2:
		print('Yes')
	else:
		print('No')


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


from sys import stdin
stdint = lambda : int(stdin.readline())
mul = lambda : map(int, stdin.readline().strip().split())
for _ in range(stdint()):
	(n, m) = mul()
	if n == 1 or m == 1:
		if n == 1 and m == 2:
			print('Yes')
		elif m == 1 and n == 2:
			print('Yes')
		else:
			print('No')
	elif n % 2 == 0 or m % 2 == 0:
		print('Yes')
	else:
		print('No')


t = int(input())
while t > 0:
	(x, y) = map(int, input().split())
	if x == 1 and y != 2 or (y == 1 and x != 2):
		print('No')
	elif x % 2 == 0 or y % 2 == 0:
		print('Yes')
	else:
		print('No')
	t -= 1


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


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


def testcase(N: int, M: int) -> bool:
	return N == 1 and M == 2 or (N == 2 and M == 1) or (N != 1 and M != 1 and (N % 2 == 0 or M % 2 == 0))

def main() -> None:
	T = int(input())
	for _ in range(T):
		(N, M) = map(int, input().split())
		print('Yes' if testcase(N, M) else 'No')
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a % 2 == 0 or b % 2 == 0:
		if min(a, b) != 1:
			print('Yes')
		elif max(a, b) == 2:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


for _ in range(int(input())):
	(N, M) = map(int, input().split())
	if N == 1 or M == 1:
		if N + M == 3:
			print('Yes')
		else:
			print('No')
	elif N % 2 != 0 and M % 2 != 0:
		print('No')
	else:
		print('Yes')


T = int(input())
while T > 0:
	(n, m) = map(int, input().split())
	r = min((n, m))
	c = max((n, m))
	if r == 1:
		if c == 2:
			print('Yes')
		else:
			print('No')
	elif r % 2 != 0 and c % 2 != 0:
		print('No')
	else:
		print('Yes')
	T -= 1


def solve(n, m):
	if n == 1 and m == 1:
		return 'No'
	if min(n, m) == 1 and max(n, m) > 2:
		return 'No'
	if n % 2 == 0 or m % 2 == 0:
		return 'Yes'
	else:
		return 'No'
t = int(input())
for _ in range(t):
	(n, m) = list(map(int, input().split()))
	print(solve(n, m))


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


T = int(input())
for i in range(0, T):
	(N, M) = map(int, input().split())
	if N == 1:
		if M == 2:
			print('Yes')
		else:
			print('No')
	elif M == 1:
		if N == 2:
			print('Yes')
		else:
			print('No')
	elif N % 2 == 0 or M % 2 == 0:
		print('Yes')
	else:
		print('No')


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


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a == 1 or b == 1:
		if a + b == 3:
			print('Yes')
		else:
			print('No')
	elif a % 2 == 0 or b % 2 == 0:
		print('Yes')
	else:
		print('No')


for j in range(int(input())):
	(n, m) = map(int, input().split())
	ans = 'No'
	if min(n, m) == 1 and max(n, m) == 2:
		ans = 'Yes'
	elif min(n, m) > 1 and (n % 2 == 0 or m % 2 == 0):
		ans = 'Yes'
	print(ans)


import os, sys, io, math
from array import *
from math import *
from bisect import *
from heapq import *
from functools import *
from itertools import *
from collections import *
I = lambda : [*map(int, sys.stdin.readline().split())]
IS = lambda : input()
IN = lambda : int(input())
IF = lambda : float(input())
for _ in range(IN()):
	(a, b) = map(int, input().split())
	if a * b & 1:
		print('No')
	elif a == 2 and b == 1 or (a == 1 and b == 2):
		print('Yes')
	elif a == 1 or b == 1:
		print('No')
	elif a & 1 == 0 or b & 1 == 0:
		print('Yes')
	else:
		print('No')


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


t = int(input())
for _ in range(t):
	(n1, m1) = input().split()
	n = int(n1)
	m = int(m1)
	if min(n, m) == 1 and max(n, m) == 2:
		print('Yes')
		continue
	if n == 1 or m == 1:
		print('No')
		continue
	if n % 2 == 1 and m % 2 == 1:
		print('No')
	else:
		print('Yes')


import math
t = int(input())
for x in range(t):
	(n, m) = [int(i) for i in input().split(' ')]
	if n == 2 and m == 1 or (n == 1 and m == 2):
		print('Yes')
	elif n % 2 == 0 and m >= 2 or (m % 2 == 0 and n >= 2):
		print('Yes')
	else:
		print('No')


import math
t = int(input())
for _ in range(t):
	(n, m) = list(map(int, input().split()))
	if n == 1 or m == 1:
		if n + m == 3:
			print('Yes')
		else:
			print('No')
	elif n % 2 == 0 or m % 2 == 0:
		print('Yes')
	else:
		print('No')


def solve():
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		a = max(n, m)
		if a == 2:
			print('Yes')
		else:
			print('No')
		return
	if n * m % 2 == 0:
		print('Yes')
	else:
		print('No')
t = int(input())
while t:
	solve()
	t -= 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == 1 or b == 1:
		if a == 2 or b == 2:
			print('Yes')
			continue
		else:
			print('No')
			continue
	if a & 1 and b & 1:
		print('No')
	else:
		print('Yes')


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


from math import gcd
for t in range(int(input())):
	(N, M) = [int(i) for i in input().split()]
	if N % 2 and M % 2:
		print('No')
	elif 1 in [M, N]:
		if 2 in [M, N]:
			print('Yes')
		else:
			print('No')
	else:
		print('Yes')


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	if min(n, m) == 1 and max(n, m) == 2 or (min(n, m) >= 2 and (n % 2 == 0 or m % 2 == 0)):
		print('Yes')
	else:
		print('No')


for q in range(int(input())):
	(n, m) = [int(x) for x in input().split()]
	if n == 1 or m == 1:
		if max(n, m) == 2:
			print('Yes')
		else:
			print('No')
	elif n % 2 == m % 2 == 1:
		print('No')
	else:
		print('Yes')


def soln(n, m):
	if n == 1 and m == 2 or (m == 1 and n == 2):
		return 'Yes'
	if n == 1 or m == 1:
		return 'No'
	if n & 1 and m & 1:
		return 'No'
	return 'Yes'
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print(soln(n, m))


for i in range(int(input())):
	(x, y) = map(int, input().split())
	if x == 1 and y != 2 or (y == 1 and x != 2):
		print('No')
	elif x + y == 3 or x % 2 == 0 or y % 2 == 0:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(N, M) = map(int, input().split())
	ans = 'Yes'
	if N == 1 and M > 2 or (M == 1 and N > 2):
		ans = 'No'
	elif N & 1 and M & 1:
		ans = 'No'
	print(ans)


t = int(input())
for _ in range(t):
	a = list(map(int, input().split()))
	if a[0] == 1:
		if a[1] == 2:
			print('Yes')
		else:
			print('No')
	elif a[1] == 1:
		if a[0] == 2:
			print('Yes')
		else:
			print('No')
	elif a[0] % 2 != 0 and a[1] % 2 != 0:
		print('No')
	else:
		print('Yes')


for t in range(int(input())):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		if n + m == 3:
			print('Yes')
			continue
		print('No')
		continue
	if n % 2 == 0:
		print('Yes')
		continue
	if m % 2 == 0:
		print('Yes')
		continue
	print('No')