You are given a special jigsaw puzzle consisting of $n\cdot m$ identical pieces. Every piece has three tabs and one blank, as pictured below. $\{3$ 

The jigsaw puzzle is considered solved if the following conditions hold:  The pieces are arranged into a grid with $n$ rows and $m$ columns.  For any two pieces that share an edge in the grid, a tab of one piece fits perfectly into a blank of the other piece. 

Through rotation and translation of the pieces, determine if it is possible to solve the jigsaw puzzle.


-----Input-----

The test consists of multiple test cases. The first line contains a single integer $t$ ($1\le t\le 1000$) — the number of test cases. Next $t$ lines contain descriptions of test cases.

Each test case contains two integers $n$ and $m$ ($1 \le n,m \le 10^5$).


-----Output-----

For each test case output a single line containing "YES" if it is possible to solve the jigsaw puzzle, or "NO" otherwise. You can print each letter in any case (upper or lower).


-----Example-----
Input
3
1 3
100000 100000
2 2

Output
YES
NO
YES



-----Note-----

For the first test case, this is an example solution:  [Image] 

For the second test case, we can show that no solution exists.

For the third test case, this is an example solution: $\left\{\begin{array}{l}{3} \\{3} \end{array} \right\}$

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
for _ in range(int(input())):
	(n, m) = list(map(int, input().split()))
	if n == m and n == 2:
		print('YES')
	elif n >= 2 and m >= 2:
		print('NO')
	else:
		print('YES')


def sol(n, m):
	if n == 1 or m == 1:
		return 0
	elif n == 2 and m == 2:
		return 0
	else:
		return 1
t = int(input())
for x in range(t):
	(n, m) = map(int, input().split())
	flag = sol(n, m)
	if flag == 0:
		print('Yes')
	else:
		print('No')


number = int(input())
for i in range(number):
	inputs = input()
	(m, n) = list(map(int, inputs.split(' ')))
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for test in range(t):
	(n, m) = list(map(int, input().split()))
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')


f = int(input())
g = []
for i in range(f):
	j = list(map(int, input().split()))
	a = j[0]
	b = j[1]
	h = a * b * 3
	n = a + b + a + b + a * b
	if h <= n:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	(n, m) = map(int, input().split())
	if n >= 2 and m >= 2 and ((n, m) != (2, 2)):
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n * k <= n + k:
		print('YES')
	else:
		print('NO')


def ans(n, m):
	(n, m) = (min(n, m), max(n, m))
	if n <= 2 and m <= 2:
		return 'YES'
	if n == 1:
		return 'YES'
	return 'NO'
T = int(input())
for t in range(T):
	(n, m) = input().split(' ')
	(n, m) = (int(n), int(m))
	print(ans(n, m))


import sys
from collections import Counter
inp = sys.stdin.readline
read = lambda : list(map(int, inp().strip().split()))

def a():
	ans = ''
	for _ in range(int(inp())):
		(n, m) = read()
		if n == 1 or m == 1:
			ans += 'YES\n'
		elif n == 2 and m == 2:
			ans += 'YES\n'
		else:
			ans += 'NO\n'
	print(ans)
a()


from sys import stdin as cin
t = int(input())
for i in range(t):
	a = list(map(int, cin.readline().split(' ')))
	a.sort()
	if a[0] < 2:
		print('YES')
	elif a[1] <= 2:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if min(n, m) == 1 or max(n, m) == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	if n - 1 + (2 * n - 1) * (m - 1) <= n * m:
		print('YES')
	else:
		print('NO')


import math
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	nm = input().split()
	n = int(nm[0])
	m = int(nm[1])
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


import sys

def main():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, sys.stdin.readline().split())
		if min(n, m) == 1 or (n == 2 and m == 2):
			print('YES')
		else:
			print('NO')
	return
main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x
for t in range(int(input())):
	(n, m) = list(map(int, input().split()))
	if n == 1 or m == 1:
		print('YES')
	elif n == 2:
		print('YES' if m == 2 else 'NO')
	else:
		print('NO')


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


ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda : int(input())
ip = lambda : [int(w) for w in input().split()]
mp = lambda : map(int, input().split())
for _ in range(int(input())):
	(n, m) = mp()
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a == 2 and b == 2:
		print('YES')
	elif a == 1 or b == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	flag = 0
	if n == 1 or m == 1:
		flag = 1
	elif n == 2 and m == 2:
		flag = 1
	if flag == 1:
		print('YES')
	else:
		print('NO')


q = int(input())
for _ in range(q):
	(n, m) = map(int, input().split())
	if n == 2 and m == 2 or n == 1 or m == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n1, m1) = input().split()
	n = int(n1)
	m = int(m1)
	c = n * m
	d = n * (m - 1) + m * (n - 1)
	if c >= d:
		print('YES')
	else:
		print('NO')


n = int(input())
x = [0] * n
for i in range(0, n):
	x[i] = list(map(int, input().split()))
for i in range(0, n):
	if x[i][0] + x[i][1] >= x[i][0] * x[i][1]:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if n == m == 2:
		print('YES')
	elif n == 1 or m == 1:
		print('YES')
	else:
		print('NO')


test = int(input())
test_arr = []
for _ in range(test):
	(a, b) = map(int, filter(None, input().split(' ')))
	if a == 1 or (a == 2 and b <= 2) or b == 1:
		test_arr.append('YES')
	else:
		test_arr.append('NO')
for t in test_arr:
	print(t)


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


for t in range(int(input())):
	(n, m) = map(int, input().split())
	if n * m <= n + m:
		print('YES')
	else:
		print('NO')


from pprint import pprint
import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	if a == 1:
		print('YES')
	elif a == 2 and b == 2:
		print('YES')
	else:
		print('NO')


def solve():
	(N, M) = map(int, input().split())
	if N == 1 or M == 1:
		print('YES')
	elif N == 2 and M == 2:
		print('YES')
	else:
		print('NO')
for _ in range(int(input())):
	solve()


test_case = int(input())
for _ in range(test_case):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
		continue
	if n == 2 and m == 2:
		print('YES')
		continue
	print('NO')


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


def solve():
	(n, m) = map(int, input().split())
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
		return 0
	print('NO')
n = int(input())
for _ in range(n):
	solve()


test = int(input())
while test > 0:
	(n, m) = map(int, input().split(' '))
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')
	test -= 1


s = []
for inii in range(int(input())):
	(n, m) = map(int, input().split())
	if n == m == 2 or m == 1 or n == 1:
		s.append('yes')
	else:
		s.append('no')
for i in s:
	print(i)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nlargest, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	(n, m) = sp()
	if n == 1 or m == 1:
		out('YES')
		continue
	if min(n, m) == 2 and max(n, m) <= 2:
		out('YES')
		continue
	out('NO')


from sys import *
input = stdin.readline
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	ch = 0
	if n == 1 or m == 1:
		ch = 1
	elif n == 2 and m == 2:
		ch = 1
	if ch == 1:
		stdout.write('YES\n')
	else:
		stdout.write('NO\n')


from sys import stdin
a = int(stdin.readline())
for b in range(0, a):
	c = stdin.readline().split()
	A = int(c[0])
	B = int(c[1])
	if A == 1 or B == 1:
		print('YES')
		continue
	if A == 2 and B == 2:
		print('YES')
		continue
	print('NO')


def solve(r, c):
	if r == 1 or c == 1:
		return 1
	elif r == 2 and c == 2:
		return 1
	else:
		return 0
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if solve(n, m):
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	(n, m) = map(int, input().strip().split(' '))
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


def solve(n, m):
	if m == 1 or n == 1:
		return True
	if m == 2 and n == 2:
		return True
	return False
t = int(input())
for we in range(t):
	(n, m) = map(int, input().split())
	if solve(n, m):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	x = input()
	x1 = x.split()
	n = int(x1[0])
	m = int(x1[1])
	if min(m, n) > 1:
		if max(m, n) <= 2:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	(a, b) = [int(i) for i in input().split()]
	if a == b == 2 or a == 1 or b == 1:
		print('YES')
	else:
		print('NO')


n = int(input())

def solve():
	(n, m) = map(int, input().split())
	if n + m <= 4 or n == 1 or m == 1:
		print('YES')
	else:
		print('NO')
for i in range(n):
	solve()


import sys
cin = sys.stdin.buffer.readline
for _ in range(int(cin())):
	(n, m) = map(int, cin().split())
	print(['no', 'yes'][(n == 1 or m == 1) or (n == 2 and m == 2)])


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


for i in range(int(input())):
	(m, n) = map(int, input().rstrip().split())
	print('YES') if m * n <= m + n else print('NO')


from sys import stdin

def main():
	readline = stdin.readline
	t = int(readline())
	for i in range(t):
		(n, m) = map(int, readline().split())
		if n == 1 or m == 1:
			print('YES')
		elif n == 2 and m == 2:
			print('YES')
		else:
			print('NO')
main()


def to_list(s):
	return list(map(lambda x: int(x), s.split(' ')))

def solve(n, m):
	if (n == 1) | (m == 1) | (n == 2) & (m == 2):
		return 'YES'
	else:
		return 'NO'
t = int(input())
answers = []
for i in range(t):
	(n, m) = to_list(input())
	answers.append(solve(n, m))
print('\n'.join(answers))


for i in range(int(input())):
	(n, m) = input().split(' ')
	if n == '1' or m == '1' or n == m == '2':
		print('YES')
	else:
		print('NO')


import math
from decimal import Decimal
import heapq
import copy
import heapq
from collections import deque

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def da():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	return (n, m, a)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def fact(n):
	tc = []
	ans = {}
	d = 2
	while d * d <= n:
		if n % d == 0:
			tc.append(d)
			n //= d
		else:
			d += 1
	if n > 1:
		tc.append(n)
	for i in tc:
		ans[i] = ans.get(i, 0) + 1
	return ans

def how_many(l, r, c):
	m = (l + r) // 2
	if r - l == 1:
		if s[l] == c:
			return 0
		else:
			return 1
	d = s[l:m]
	k1 = (r - l) // 2 - s[l:m].count(c) + how_many(m, r, chr(ord(c) + 1))
	k2 = (r - l) // 2 - s[m:r].count(c) + how_many(l, m, chr(ord(c) + 1))
	return min(k1, k2)
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	(n, m) = (min(n, m), max(n, m))
	if n == 1:
		print('YES')
		continue
	if n > 2 or m > 2:
		print('NO')
	else:
		print('YES')


import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def solve():
	(n, m) = num_input()
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	solve()


def solve():
	(n, m) = list(map(int, input().split()))
	(n, m) = (min(n, m), max(n, m))
	if n == 2 and m == 2 or (n == 1 and m >= 1):
		print('YES')
	else:
		print('NO')
	return
t = 1
t = int(input())
while t > 0:
	t -= 1
	solve()


cases = int(input())
for _ in range(cases):
	(n, m) = [int(s) for s in input().split()]
	if n == 1:
		print('YES')
	elif m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for j in range(t):
	(n, m) = map(int, input().split(' '))
	if min(n, m) == 1:
		print('Yes')
	elif n == m == 2:
		print('Yes')
	else:
		print('No')


t = int(input())
for z in range(t):
	(n, m) = map(int, input().split())
	flag = 0
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
		flag = 1
	elif flag == 0:
		print('NO')


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	if x == 1 or y == 1:
		print('YES')
	elif x == 2 | y == 2:
		print('YES')
	else:
		print('NO')


def integer(array):
	for i in range(len(array)):
		array[i] = int(array[i])
	return array
N = int(input())
inputs = []
for i in range(N):
	inputs.append(integer(str(input()).split(' ')))

def puzzle(m, n):
	if m * n > m + n:
		return 'NO'
	return 'YES'
for i in inputs:
	print(puzzle(i[0], i[1]))


t = int(input())
for _ in range(t):
	(p, q) = map(int, input().split())
	if p == 1 or q == 1:
		print('YES')
	elif p == 2 and q == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	string = input()
	list1 = string.split()
	n = int(list1[0])
	m = int(list1[1])
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')


count = int(input())
for i in range(count):
	numbers = input().split(' ')
	n = int(numbers[0])
	m = int(numbers[1])
	if n * m <= n + m:
		print('YES')
	else:
		print('NO')


def solve(n, m):
	if n == 1 and m >= 1:
		return 'YES'
	if n >= 1 and m == 1:
		return 'YES'
	if n == 2 and m == 2:
		return 'YES'
	if n >= 2 and m > 2:
		return 'NO'
	if n > 2 and m >= 2:
		return 'NO'
t = int(input())
for _ in range(t):
	(n, m) = list(map(int, input().split()))
	print(solve(n, m))


import sys
from sys import stdin
from collections import defaultdict

def eprint(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)

def inputs(f=int):
	return list(map(f, stdin.readline().strip().split()))

def solve(m, n):
	if m == 1 or n == 1:
		return 'YES'
	elif m == 2 and n == 2:
		return 'YES'
	elif m > 2 or n > 2:
		return 'NO'
	else:
		raise ValueError()
T = int(input())
for i in range(T):
	(M, N) = inputs()
	ans = solve(M, N)
	print(ans)


import sys
input = sys.stdin.readline
t = int(input())
nm = [list(map(int, input().split())) for _ in range(t)]
for (n, m) in nm:
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t, 1):
	(m, n) = map(int, input().split())
	if m == 1 or n == 1:
		print('YES')
	else:
		pi = m * n
		pl = (m - 1) * n + (n - 1) * m
		if pi == pl:
			print('YES')
		else:
			print('NO')


for s in [*open(0)][1:]:
	(a, b) = map(int, s.split())
	print('NYOE S'[a < 2 or b < 2 or max(a, b) < 3::2])


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print('YES' if n == m == 2 or n < 2 or m < 2 else 'NO')


import math
from collections import Counter, deque
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
IN = lambda : input()
mod = 10 ** 9 + 7

def s(a):
	print(' '.join(list(map(str, a))))
for _ in range(I()):
	(n, m) = M()
	if n == 1 or m == 1 or n * m == 4:
		print('YES')
	else:
		print('NO')


a = int(input())
for _ in range(a):
	(h1, m1) = map(int, input().split())
	ans = (h1 - 1) * m1 + (m1 - 1) * h1
	if ans <= h1 * m1:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
from collections import defaultdict as dd, deque as dq
import bisect
t = int(input())
while t:
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for _ in range(0, t):
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
import sys
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if n == 1:
		print('YES')
	elif m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
cases = [tuple(map(int, input().split())) for _ in range(t)]
for case in cases:
	(n, m) = map(int, case)
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


from sys import stdin
input = stdin.readline

def list_input():
	return list(map(int, input().split()))

def sep_input():
	return map(int, input().split())
for _ in range(int(input())):
	(n, m) = sep_input()
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
arr = []
for i in range(t):
	(n, m) = map(int, input().split())
	if n == 2 and m == 2:
		arr.append('YES')
	elif n == 1 or m == 1:
		arr.append('YES')
	else:
		arr.append('NO')
for i in arr:
	print(i)


import math
import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	cur = (n - 1) * m + (m - 1) * n
	if cur > n * m:
		print('NO')
	else:
		print('YES')


N = int(input())

def solve(A, B):
	(A, B) = (min(A, B), max(A, B))
	if A == 1:
		return 'YES'
	if A == 2 and B == 2:
		return 'YES'
	return 'NO'
for _ in range(N):
	(A, B) = [int(x) for x in input().split()]
	print(solve(A, B))


for _ in range(int(input())):
	(l, r) = map(int, input().split())
	if l == 1 or r == 1 or (l == 2 and r == 2):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(row, col) = map(int, input().split())
	if row == 1 or col == 1:
		print('YES')
	elif row <= 2 and col <= 2:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	(n, m) = map(int, input().split())
	ans = 'no'
	if m * n == m or m * n == n:
		ans = 'yes'
	elif m < 3 and n < 3:
		ans = 'yes'
	print(ans)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if x == 1 or y == 1:
		print('YES')
	elif x == 2 and y == 2:
		print('YES')
	else:
		print('NO')


cases = input()
for i in range(int(cases)):
	a = list(map(int, input().split()))
	n = a[0]
	m = a[1]
	score = 2 * m * n
	sides = 2 * (m + n)
	if score <= sides:
		print('YES')
	else:
		print('NO')


def ans(n, m):
	if n == 1 or m == 1:
		return 'YES'
	elif n == m and m == 2:
		return 'YES'
	return 'NO'
n = int(input())
L = []
for i in range(n):
	(a, b) = map(int, input().split())
	L.append(ans(a, b))
for l in L:
	print(l)


MOD = 10 ** 9 + 7

def main():
	test = int(input())
	for iteration in range(test):
		(n, m) = [int(i) for i in input().split()]
		if n == 1 or m == 1:
			print('YES')
		elif n == 2 and m == 2:
			print('YES')
		else:
			print('NO')
main()


import sys, math, cmath, time
start_time = time.time()
tt = 0

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def solve():
	(n, m) = invr()
	if (n == 1 or m == 1) or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')

def main():
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
	sys.stdout.close()

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


tests = int(input())
for test in range(tests):
	inputs = input().split(' ')
	n = int(inputs[0])
	m = int(inputs[1])
	if n == 2 and m == 2:
		print('YES')
	elif n <= 1 or m <= 1:
		print('YES')
	else:
		print('NO')


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Prime_factors(n):
	i = 2
	factors = set()
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.add(i)
	if n > 1:
		factors.add(n)
	print(factors)
	if len(factors) == 2:
		return True
	else:
		return False

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def Sieve(n):
	prime = [True for i in range(n + 1)]
	lst = []
	p = 2
	while p * p <= n:
		if prime[p]:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p = p + 1
	for i in range(2, n + 1):
		if prime[i]:
			lst.append(i)
	return lst

def minimum_integer_not_in_list(a):
	b = max(a)
	if b < 1:
		return 1
	A = set(a)
	B = set(range(1, b + 1))
	D = B - A
	if len(D) == 0:
		return b + 1
	else:
		return min(D)

def solution():
	for i in range(Int()):
		(n, m) = Mint()
		if n * m <= n + m:
			print('YES')
		else:
			print('NO')
solution()


T = int(input())
for i in range(T):
	sr = list(map(int, input().split(' ')))
	(i, j) = (sr[0], sr[1])
	if i == 1 or j == 1:
		print('YES')
	elif i == 2 and j == 2:
		print('YES')
	else:
		print('NO')


import math
import collections
from sys import stdin, stdout
M = 10 ** 9 + 7
t = int(stdin.readline())
for _ in range(t):
	(n, m) = list(map(int, stdin.readline().split()))
	if n == 1 or m == 1:
		print('YES')
		continue
	if n == 2 and m == 2:
		print('YES')
		continue
	else:
		print('NO')


from sys import stdin, stdout
import math
import heapq
t = 1

def aint():
	return int(input().strip())

def lint():
	return list(map(int, input().split()))

def fint():
	return list(map(int, stdin.readline().split()))

def main():
	(n, m) = lint()
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(t):
	main()


import math
t = int(input())
while t > 0:
	t -= 1
	(n, m) = map(int, input().split())
	if n == 2 and m == 2:
		print('YES')
	elif n == 1 or m == 1:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout

def input():
	a = stdin.readline()
	if a[-1] == '\n':
		a = a[:-1]
	return a

def print(*argv, end='\n', sep=' '):
	n = len(argv)
	for i in range(n):
		if i == n - 1:
			stdout.write(str(argv[i]))
		else:
			stdout.write(str(argv[i]) + sep)
	stdout.write(end)
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	lst = []
	for i in range(n):
		temp = [default] * m
		lst.append(temp)
	return lst

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

def solve(n, m):
	if n == 1 or m == 1:
		return 'YES'
	elif n == 2 and m == 2:
		return 'YES'
	else:
		return 'NO'
for _ in range(int(input())):
	(n, m) = list(map(int, input().split()))
	print(solve(n, m))


n = int(input())
a = []
for i in range(n):
	a.append(input().split())
for i in range(n):
	for j in range(2):
		a[i][j] = int(a[i][j])
for i in range(n):
	if a[i][0] <= 2 and a[i][1] <= 2 or a[i][0] == 1 or a[i][1] == 1:
		print('YES')
	else:
		print('NO')


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys

def solve(n, m):
	if n == 1 or m == 1:
		return 'YES'
	if n == 2 and m == 2:
		return 'YES'
	return 'NO'

def main():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, input().split())
		ans = solve(n, m)
		sys.stdout.write(ans + '\n')
main()


T = int(input())

def solve():
	[N, M] = list(map(int, input().split()))
	if N == 1 or M == 1:
		print('YES')
		return
	if N == 2 and M == 2:
		print('YES')
		return
	print('NO')
for _ in range(T):
	solve()


import os

def pp(input):
	n_test = int(input())
	for i in range(n_test):
		(n, m) = map(int, input().split())
		if n == 1 or m == 1 or (n == 2 and m == 2):
			print('YES')
		else:
			print('NO')
if 'paalto' in os.getcwd():
	from string_source import string_source
	s1 = string_source('3\n1 3\n100000 100000\n2 2\n')
	pp(s1)
else:
	pp(input)


import sys
input = sys.stdin.readline

def solve(n, m):
	if n == 1 or m == 1:
		return 'YES'
	if n <= 2 and m <= 2:
		return 'YES'
	return 'NO'
t = int(input())
for _ in range(t):
	[n, m] = list(map(int, input().split()))
	print(solve(n, m))


t = int(input())
for w in range(1, t + 1):
	(n, m) = map(str, input().split())
	(n, m) = (int(n), int(m))
	if n == 1 or m == 1:
		print('YES')
	elif n <= 2 and m <= 2:
		print('YES')
	else:
		print('NO')


i = int(input())
for x in range(i):
	(m, n) = input().split(' ')
	(m, n) = (int(m), int(n))
	if min(m, n) == 1:
		print('YES')
	elif max(m, n) == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	l = []
	l = list(map(int, input().split()))
	n = l[0]
	m = l[1]
	if m == 1 or n == 1:
		print('YES')
	if m == 2 and n == 2:
		print('YES')
	if m > 2 or n > 2:
		if m != 1 and n != 1:
			print('NO')


from sys import stdin

def func():
	return
for _ in range(int(stdin.readline())):
	(n, m) = map(int, stdin.readline().split())
	if min(n, m) > 2:
		print('NO')
	elif min(n, m) == 2:
		if max(n, m) == 2:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(row, col) = map(int, input().split())
	edges = row * (col - 1) + col * (row - 1)
	open = row * col
	if edges > open:
		print('NO')
	else:
		print('YES')


def f(n, m):
	if n > 1 and m == 1 or n == 1 or m == 1 or (m > 2 and n == 1) or (n == 2 and m == 2):
		return 'YES'
	else:
		return 'NO'
solve = []
for i in range(int(input())):
	(n, m) = map(int, input().split())
	solve.append(f(n, m))
for i in solve:
	print(i)


from sys import stdin, stdout
t = int(stdin.readline().strip())
for _ in range(t):
	(n, m) = list(map(int, stdin.readline().strip().split()))
	if n == 1 or m == 1 or (n == 2 and m == 2):
		stdout.write('YES' + '\n')
	else:
		stdout.write('NO' + '\n')


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


t = int(input())
count = 0
out = []
while count < t:
	(n, m) = input().split()
	total_puzz_need = int(n) * int(m)
	if int(n) + int(m) < total_puzz_need:
		out.append('NO')
	else:
		out.append('YES')
	count += 1
for x in out:
	print(x)


t = int(input())
while t:
	(a, b) = map(int, input().split())
	print('YES' if a == 1 or b == 1 or a * b == 4 else 'NO')
	t -= 1


def read_list():
	return list(map(int, input().split(' ')))
N = int(input())
for _ in range(N):
	a = read_list()
	if min(a) > 2:
		print('No')
	elif min(a) == 1 or a == [2, 2]:
		print('Yes')
	else:
		print('No')


def solve():
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
		return
	elif n == 2 and m == 2:
		print('YES')
		return
	else:
		print('NO')
		return
for _ in ' ' * int(input()):
	solve()


for tt in range(int(input())):
	m = [int(i) for i in input().split()]
	if (m[0] == 1 or m[1] == 1) or (m[0] == 2 and m[1] == 2):
		print('YES')
	else:
		print('NO')


def can_solve(n, m):
	if n == 1 or m == 1:
		return 'YES'
	if n == 1 and m == 1:
		return 'YES'
	if n == 2 and m == 2:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	print(can_solve(n, m))


def compute(n, m):
	if n == 1 or m == 1 or (n == 2 and m == 2):
		return 'YES'
	else:
		return 'NO'
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	print(compute(n, m))


import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = pow(10, 9) + 7

def inp():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def solve():
	(a, b) = sep()
	if a == 1 or b == 1:
		print('YES')
	elif a > 2 or b > 2:
		print('NO')
	else:
		print('YES')
testcase(int(inp()))


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n * m == 1:
		print('YES')
		continue
	t = 3 * n * m
	t -= (n - 1) * m
	t -= n * (m - 1)
	if t <= 2 * (n + m):
		print('YES')
	else:
		print('NO')


from functools import reduce
import sys

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(delimiter=' '):
		return input().split(delimiter)

	@staticmethod
	def list_int(delimiter=' '):
		return list(map(int, input().split(delimiter)))

def main():
	t = Read.int()
	for _ in range(t):
		(n, m) = Read.list_int()
		print('YES') if n == 1 or m == 1 or (m == 2 and n == 2) else print('NO')
main()


val = False
n = int(input())
for _ in range(n):
	(n, m) = [int(x) for x in input().split()]
	if n == 1 or m == 1:
		val = True
	if m == n and m == 2:
		val = True
	if val:
		print('YES')
	else:
		print('NO')
	val = False


from sys import stdin, stdout
test = int(stdin.readline())
for _ in range(test):
	(N, M) = map(int, stdin.readline().split())
	if N == 1 or M == 1:
		print('YES')
		continue
	if N == 2 and M == 2:
		print('YES')
		continue
	print('NO')


t = int(input())
for _ in range(t):
	mn = input().split()
	(m, n) = (int(mn[0]), int(mn[1]))
	if m == 1 or n == 1:
		print('YES')
	elif m * n == 4:
		print('YES')
	else:
		print('NO')


a = int(input())
for d in range(a):
	(f, ff) = [int(g) for g in input().split()]
	if ff == f == 2 or ff == 1 or f == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	(r, c) = map(int, input().split())
	if (r == 1 or c == 1) or (r == 2 and c == 2):
		print('YES')
	else:
		print('NO')


t = int(input())
for case in range(t):
	(n, m) = list(map(int, input().split()))
	if min(n, m) == 1:
		print('YES')
	elif n == m and n == 2:
		print('YES')
	else:
		print('NO')


cases = int(input())
ans = list()
for i in range(cases):
	(m, n) = input().split()
	m = int(m)
	n = int(n)
	if m == 1 or n == 1:
		ans.append('YES')
	elif m == 2 and n == 2:
		ans.append('YES')
	else:
		ans.append('NO')
for i in ans:
	print(i)


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	(n, m) = int_array()
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m) = list(map(int, input().split()))
	if n * m <= n + m:
		print('YES')
	else:
		print('NO')


def getN():
	return int(input())

def getNM():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))
from collections import defaultdict, deque
from sys import exit
import math
import copy
from bisect import bisect_left
import sys

def solve():
	(a, b) = getList()
	if a == 1 or b == 1:
		print('YES')
		return
	if a == 2 and b == 2:
		print('YES')
		return
	print('NO')
	return

def main():
	n = getN()
	for _ in range(n):
		solve()
main()


for i in [*open(0)][1:]:
	(n, m) = map(int, i.split())
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')


x = int(input())
for i in range(0, x):
	(r, c) = input().split()
	r = int(r)
	c = int(c)
	if r == 1 or c == 1:
		print('YES')
	elif r == 2 and c == 2:
		print('YES')
	else:
		print('NO')


from math import *
mod = 10 ** 9 + 7

def _in():
	return [int(x) for x in input().split(' ')]

def main():
	(n, m) = _in()
	if n == 2 and m == 2:
		print('YES')
	elif n == 1 or m == 1:
		print('YES')
	else:
		print('NO')
for _ in range(int(input())):
	main()


def solve(n, m):
	pieces_nb = n * m
	inside_edges = (n - 1) * m + (m - 1) * n
	if inside_edges <= pieces_nb:
		return 'YES'
	return 'NO'

def main():
	T = int(input())
	for i in range(1, T + 1):
		(n, m) = [int(i) for i in input().split(' ')]
		result = solve(n, m)
		print(result)
main()


def solve(n, m):
	if n == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	elif n >= 1 and m == 1:
		print('YES')
	else:
		print('NO')

def main():
	t = int(input())
	for i in range(t):
		(n, m) = list(map(int, input().split()))
		solve(n, m)
main()


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())
for case in range(itg()):
	(n, m) = mpint()
	if n == 1 or m == 1 or n + m == 4:
		print('YES')
	else:
		print('NO')


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


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1 or n * m == 4:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	(a, b) = [int(tmp) for tmp in input().split()]
	if a == 1:
		print('YES')
	elif a == 2 and b == 2:
		print('YES')
	elif b == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if n == 1 or (m == 2 and n == 2) or m == 1:
		print('yes')
	else:
		print('no')


t = int(input())
while t != 0:
	i = []
	i = input().split()
	if int(i[0]) == 1:
		print('YES')
	elif int(i[1]) == 1:
		print('YES')
	elif int(i[0]) == 2 and int(i[1]) == 2:
		print('YES')
	else:
		print('NO')
	t = t - 1


def solve(row, col):
	if row == 1 or col == 1:
		return True
	if (row - 1) * col + (col - 1) * row != row * col:
		return False
	return True
testCase = int(input())
for i in range(testCase):
	(r, c) = input().split()
	ans = solve(int(r), int(c))
	if ans:
		print('Yes')
	else:
		print('nO')


def main():
	t = int(input())
	for _ in range(t):
		(x, y) = [int(x) for x in input().split(' ')]
		if x == 2 and y == 2:
			print('YES')
		elif min(x, y) == 1:
			print('YES')
		else:
			print('NO')
main()


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	mn = min(n, m)
	if mn == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	nm = input().split()
	n = int(nm[0])
	m = int(nm[1])
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')
	t -= 1


t = input()
t = int(t)
while t > 0:
	(s, n) = input().split()
	s = int(s)
	n = int(n)
	if n + s > 4 and n != 1 and (s != 1):
		print('NO')
	else:
		print('YES')
	t -= 1


from sys import stdout, stdin
(_input, _print) = (stdin.buffer.readline, stdout.write)
(_int, _range, _max, _min) = (int, range, max, min)

def solution():
	for _ in _range(_int(_input())):
		(n, m) = [_int(i) for i in _input().split()]
		(w, r) = (_min(n, m), _max(n, m))
		if w == 1:
			print('YES')
		elif w == 2:
			if r == 2:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
solution()


T = int(input())
for x in range(T):
	(m, n) = (int(s) for s in input().split())
	if m == 1 or n == 1:
		print('YES')
	elif m == 2 and n == 2:
		print('YES')
	else:
		print('NO')


import collections

def solve(a, b):
	totalEdges = (b - 1) * a + (a - 1) * b
	return a * b >= totalEdges
t = int(input().strip())
for i in range(t):
	[a, b] = list(map(int, input().strip().split()))
	print('YES' if solve(a, b) else 'NO')


T = int(input())
for _ in range(0, T):
	(a, b) = map(int, input().split())
	A = min(a, b)
	B = max(a, b)
	if a == 1 or b == 1:
		print('YES')
	elif A == 2 and B == 2:
		print('YES')
	else:
		print('NO')


a = int(input())
i = 0
while i < a:
	b = list(map(int, input().split(' ')))
	if b[0] == 1 or b[1] == 1:
		print('YES')
	elif b[0] + b[1] < 5:
		print('YES')
	else:
		print('NO')
	i = i + 1


from sys import stdin

def iinput():
	return int(stdin.readline())

def sinput():
	return input()

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
t = iinput()
while t:
	t -= 1
	(n, m) = minput()
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('yes')
	else:
		print('no')


t = int(input())
for _ in range(t):
	(n, m) = tuple([int(i) for i in input().split()])
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


from sys import stdin

def r():
	return stdin.readline()

def r_t():
	return map(int, r().strip().split())

def r_a():
	return list(r_t())

def main():
	cases = int(r())
	for case in range(cases):
		(n, m) = r_t()
		if n == 1 or m == 1 or (n == 2 and m == 2):
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for w in range(t):
	(n, m) = (int(i) for i in input().split())
	if n == 1:
		print('YES')
	elif m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


import sys
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(buff_readline())

def read_int_n():
	return list(map(int, buff_readline().split()))

def read_float():
	return float(buff_readline())

def read_float_n():
	return list(map(float, buff_readline().split()))

def read_str():
	return readline().strip()

def read_str_n():
	return readline().strip().split()

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

@mt
def slv(N, M):
	(N, M) = (min(N, M), max(N, M))
	if N == 1:
		return 'Yes'
	if N + M > 4:
		return 'NO'
	return 'YES'

def main():
	T = read_int()
	for _ in range(T):
		(N, M) = read_int_n()
		print(slv(N, M))
main()


def main():
	for _ in range(int(input())):
		(n, m) = list(map(int, input().split()))
		if m == 3 and n == 1 or (m == 2 and n <= 2) or m == 1 or (n == 3 and m == 1) or (n == 2 and m <= 2) or (n == 1):
			print('YES')
		else:
			print('NO')
main()


def f(x, y):
	if x == 1 or y == 1 or max(x, y) == 2:
		return 'YES'
	return 'NO'
numberofcases = int(input())
for _ in range(numberofcases):
	(x, y) = [int(t) for t in input().split()]
	print(f(x, y))


for i in range(int(input())):
	(m, n) = map(int, input().split())
	if m == 1:
		print('YES')
	elif n == 1:
		print('YES')
	elif m * n == 4:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(r, c) = map(int, input().split())
	if r == 2 and c == 2:
		print('YES')
	elif r == 1 or c == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == 1 or b == 1:
		print('YES')
		continue
	if a == 2 and b == 2:
		print('YEs')
		continue
	print('NO')


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [i for i in input().split()]
t = int(input())
while t:
	t -= 1
	(n, m) = value()
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


a = int(input())
for i in range(a):
	b = input().split()
	c = int(b[0])
	d = int(b[1])
	if c == 1 or d == 1:
		print('yes')
	elif c == 2 and d == 2:
		print('yes')
	else:
		print('no')


from sys import stdin
n = int(stdin.readline().strip())
for i in range(n):
	(a, b) = map(int, stdin.readline().strip().split())
	if a == 1 or b == 1:
		print('YES')
	elif a == 2 and b == 2:
		print('YES')
	else:
		print('NO')


from collections import Counter
from collections import defaultdict
import math
import sys
import bisect
rs = lambda : input().strip()
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rls = lambda : list(map(str, input().split()))
from collections import deque
t = int(input())
for _ in range(0, t):
	(a, b) = rl()
	if a == 1 or b == 1 or (a == 2 and b == 2):
		print('YES')
	else:
		print('NO')


test = int(input())
for i in range(test):
	(row, column) = map(int, input().split(' '))
	if row > column:
		(row, column) = (column, row)
	if row == 1 or (row == 2 and column == 2):
		print('YES')
	else:
		print('NO')


def answer(r, c):
	if r == 1 or c == 1:
		return 'YES'
	if r == 2 and c == 2:
		return 'YES'
	return 'NO'
n = int(input())
for _ in range(n):
	(r, c) = map(int, input().split())
	print(answer(r, c))


t = int(input())
while t:
	(n, m) = [int(x) for x in input().split()]
	if n == 1 or m == 1:
		print('YES')
	elif n * m == 4:
		print('YES')
	else:
		print('NO')
	t -= 1


T = int(input())
for tc in range(T):
	(n, m) = map(int, input().split())
	if max(n, m) >= 3 and min(n, m) != 1:
		print('NO')
	else:
		print('YES')


test_num = int(input())
for n in range(test_num):
	ls = input().split()
	ls = [int(n) for n in ls]
	line = +ls[0] * (ls[1] + 1) + (ls[0] + 1) * ls[1]
	pieces = ls[0] * ls[1]
	if line >= pieces * 3:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
input = stdin.buffer.readline
t = int(input())
while t > 0:
	(n, m) = [int(x) for x in input().split()]
	if n == 2 and m == 2:
		print('YES')
	elif n < 2 or m < 2:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	if n == 1 and m == 0:
		print('YES')
		continue
	if n == 1 or m == 1:
		print('YES')
		continue
	corner = 4
	edge = 2 * (m - 2) + 2 * (n - 2)
	internal = n * m - corner - edge
	if edge + 2 * internal <= 0:
		print('YES')
	else:
		print('NO')


t = int(input())
output = []
for z in range(t):
	nm = input()
	s = nm.find(' ')
	n = int(nm[0:s])
	m = int(nm[s + 1:len(nm)])
	if n == 1 or m == 1 or (n <= 2 and m <= 2):
		output += ['YES']
	else:
		output += ['NO']
for z in range(t):
	print(output[z])


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


def main():
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		if max(a, b) > 2:
			print('YES' if min(a, b) == 1 else 'NO')
		elif max(a, b) <= 2:
			print('YES' if min(a, b) <= 2 else 'NO')
main()


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	if n >= 3 and m > 1:
		print('NO')
	elif m >= 3 and n > 1:
		print('NO')
	else:
		print('YES')


a = int(input())
for i in range(a):
	(x, y) = map(int, input().split())
	if min(x, y) == 1:
		print('YES')
	elif min(x, y) == 2 and max(x, y) == 2:
		print('YES')
	else:
		print('NO')


from sys import stdout, stdin
import io
import os
from collections import deque
input = stdin.readline
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	e = (m - 1) * n + m * (n - 1)
	if e > n * m:
		print('NO')
	else:
		print('YES')


from sys import stdin

def solve():
	return

def main():
	inp = stdin.readline
	for _ in range(int(inp())):
		(n, m) = map(int, inp().split())
		if n == 1 or m == 1:
			print('YES')
		elif n == 2 and m == 2:
			print('YES')
		else:
			print('NO')
main()


from collections import Counter
nrew = int(input())
for wew in range(nrew):
	(n, k) = list(map(int, input().split(' ')))
	if n == k == 2 or n == 1 or k == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for uu in range(t):
	(n, m) = map(int, input().split())
	if min(n, m) >= 2 and (not (m == 2 and n == 2)):
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	X = list(map(int, input().split()))
	if 1 in X or X[0] == X[1] == 2:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')


import sys
readline = sys.stdin.readline
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))

def solve():
	(n, m) = nm()
	if min(n, m) == 1 or max(n, m) == 2:
		print('YES')
	else:
		print('NO')
T = ni()
for _ in range(T):
	solve()


t = int(input())
for x in range(t):
	(n, m) = map(int, input().split())
	if n >= 3:
		if m >= 2:
			print('NO')
			continue
		else:
			print('YES')
			continue
	if m >= 3:
		if n >= 2:
			print('NO')
			continue
		else:
			print('YES')
			continue
	if n <= 2 and m <= 2:
		print('YES')
		continue


from math import *
from sys import *
from heapq import *
from collections import defaultdict
from itertools import permutations
import os, sys
from io import IOBase, BytesIO

def main():
	t = int(input())
	for _ in range(t):
		(n, m) = list(map(int, input().split()))
		if n == 1 or m == 1:
			print('YES')
			continue
		if min(n, m) >= 3 or max(n, m) >= 3:
			print('NO')
			continue
		print('YES')
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def case():
	(n, m) = li()
	if n == 1 or m == 1:
		print('YES')
	elif n == 2:
		if m <= 2:
			print('YES')
		else:
			print('NO')
	elif m == 2:
		if n <= 2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
for _ in range(int(input())):
	case()


import sys
input = sys.stdin.buffer.readline

def print(val):
	sys.stdout.write(str(val) + '\n')
for _ in range(int(input().strip())):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
while t != 0:
	(n, m) = map(int, input().split(' '))
	if n >= 3 and m != 1 or (m >= 3 and n != 1):
		print('NO')
	else:
		print('YES')
	t = t - 1


t = int(input())
c = []
for i in range(t):
	(n, m) = input().split()
	(n, m) = (int(n), int(m))
	if n == 1 or m == 1 or (n == 2 and m == 2):
		c.append('YES')
	else:
		c.append('NO')
for k in c:
	print(k)


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [Scanner.string() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [Scanner.int() for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def solve():
	(N, M) = Scanner.map_int()
	if N == 1:
		return True
	if M == 1:
		return True
	if N == 2 and M == 2:
		return True
	return False

def main():
	T = Scanner.int()
	for _ in range(T):
		print('YNEOS'[not solve()::2])
main()


def puzzle_pcs(n, m):
	if n == 1 or m == 1:
		return 'YES'
	if n == 2 and m == 2:
		return 'YES'
	return 'NO'
t = int(input())
for _ in range(t):
	(n, m) = [int(i) for i in input().split()]
	ans = puzzle_pcs(n, m)
	print(ans)


a = int(input())
for i in range(0, a):
	ar = []
	for j in input().split(' '):
		ar.append(int(j))
	if ar[0] == 2 and ar[1] == 2:
		print('YES')
		continue
	if ar[0] == 1 or ar[1] == 1:
		print('YES')
		continue
	print('NO')


import sys

def input(itr=iter(sys.stdin.readlines())):
	return next(itr).rstrip('\n\r')
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	ok = min(n, m) == 1 or n == m == 2
	print('YES' if ok else 'NO')


tc = int(input())
while tc:
	tc -= 1
	lis = [int(n) for n in input().rstrip().split()]
	(a, b) = lis
	if a == 1 or b == 1:
		print('YES')
	elif a == 2 and b == 2:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(n, m) = map(int, input().split())
	f = 1
	if n == 1 or m == 1 or (n == 2 and m == 2):
		f = 0
	print('YNEOS'[f::2])


t = int(input())
for you in range(t):
	l = input().split()
	n = int(l[0])
	m = int(l[1])
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


import math
for w in range(int(input())):
	a = list(map(int, input().split()))
	if a[0] == 1 or a[1] == 1:
		print('YES')
	elif a[0] == 2 and a[1] == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for h in range(t):
	(n, m) = list(map(int, input().split()))
	if n >= 3 and m >= 2 or (n >= 2 and m >= 3):
		print('NO')
	else:
		print('YES')


def main():
	t = int(input())
	for __ in range(t):
		(n, m) = map(int, input().split())
		if (n == 1 or m == 1) or (n == 2 and m == 2):
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for _ in range(t):
	(n, m) = [int(x) for x in input().split()]
	if n >= 2 and m >= 3 or (n >= 3 and m >= 2):
		print('NO')
	else:
		print('YES')


ans = []
for h in range(int(input())):
	(m, n) = map(int, input().strip().split())
	if m == 1 or n == 1 or (m < 3 and n < 3):
		ans.append('YES')
	else:
		ans.append('NO')
print('\n'.join(ans))


n = int(input())
l = []
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	if a <= 2 and b <= 2:
		l.append('YES')
	elif a < 2 or b < 2:
		l.append('YES')
	else:
		l.append('NO')
for x in l:
	print(x)


t = int(input())
ans = []
for i in range(t):
	(n, m) = map(int, input().split())
	if n == m == 2 or m == 1 or n == 1:
		ans.append('YES')
	else:
		ans.append('NO')
print(*ans, sep='\n')


tt = int(input())
while tt != 0:
	(n, m) = map(int, input().split())
	if n == 1 or m == 1 or n == m == 2:
		print('YES')
	else:
		print('NO')
	tt -= 1


import math
t = int(input())
while t:
	t -= 1
	(a, b) = [int(x) for x in input().split()]
	if a == 1 or b == 1 or (a == b and a == 2):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a * b <= a + b:
		print('YES')
	else:
		print('NO')


def main_function():
	from sys import stdin
	from sys import stdout
	input = stdin.readline
	print = stdout.write
	t = int(input())
	for _ in range(t):
		(n, m) = list(map(int, input().split()))
		if n == 1 or m == 1 or n == m == 2:
			print('YES\n')
		else:
			print('NO\n')
main_function()


import random
import math
LI = lambda : list(map(int, input().split()))
MI = lambda : map(int, input().split())
yes = lambda : print('Yes')
no = lambda : print('No')
I = lambda : list(input())
J = lambda x: ''.join(x)
II = lambda : int(input())
SI = lambda : input()
t = II()
for q in range(t):
	(n, m) = MI()
	if n == 1 or m == 1 or (n == 2 and m == 2):
		yes()
	else:
		no()


import sys
sys.setrecursionlimit(2000)
from collections import Counter
from functools import reduce
t = [int(val) for val in sys.stdin.readline().split()][0]
for test in range(t):
	(n, m) = [int(val) for val in sys.stdin.readline().split()]
	if n == 2 and m == 2:
		print('YES')
	elif n == 1 or m == 1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a == 2 and b == 2:
		print('Yes')
	elif a == 1 and b >= 1:
		print('Yes')
	elif a >= 1 and b == 1:
		print('Yes')
	else:
		print('No')


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0)
for _testcases_ in range(int(input())):
	(n, m) = get_ints()
	print('YES' if n == 1 or m == 1 or (n == 2 and m == 2) else 'NO')


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
		continue
	if n == 2 and m == 2:
		print('YES')
		continue
	print('NO')


def checkPuzzle(a, b):
	if a == 1 or b == 1:
		print('YES')
	elif a == 2 and b == 2:
		print('YES')
	else:
		print('NO')
test = int(input())
for cases in range(test):
	(a, b) = map(int, input().split())
	checkPuzzle(a, b)


def Spider():
	(a, b) = map(int, input().split())
	if a * b <= 4 or b == 1 or a == 1:
		print('YES')
	else:
		print('NO')
TIMES = 1
TIMES = int(input())
for TIME_TEMP in range(TIMES):
	Spider()


t = int(input())
for i in range(t):
	nm = list(map(int, input().split()))
	if nm[0] == 1 or nm[1] == 1 or (nm[0] == 2 and nm[1] == 2):
		print('YES')
	else:
		print('NO')


ii = lambda : int(input())
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
for _ in range(ii()):
	(n, m) = f()
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for x in range(t):
	(x, y) = [int(a) for a in input().split(' ')]
	if (x - 1) * (y - 1) <= 1:
		print('YES')
	else:
		print('NO')


test_case = int(input())
for q in range(test_case):
	(m, n) = [int(b) for b in input().split()]
	if m == 1 or n == 1 or (m == 2 and n == 2):
		print('YES')
	else:
		print('NO')


from collections import Counter
import math
mod = 10 ** 9 + 7
for i in range(int(input())):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


for T in range(int(input())):
	(n, m) = list(map(int, input().split()))
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


import sys
for t in range(int(sys.stdin.readline())):
	(a, b) = map(int, sys.stdin.readline().split())
	if a == 1 or b == 1 or (a == b and b == 2):
		sys.stdout.write('YES\n')
	else:
		sys.stdout.write('NO\n')


t = int(input())
mass = []
for i in range(t):
	(x, y) = map(int, input().split())
	mass.append([x, y])
for i in mass:
	n = i[0]
	m = i[1]
	if 2 * ((m - 1) * n + (n - 1) * m) + 2 * (n + m) == 4 * n * m and (m - 1) * n + (n - 1) * m <= n * m:
		print('YES')
	else:
		print('NO')


Times = int(input())
j = 0
while j < Times:
	s = input().split()
	m = int(s[0])
	n = int(s[1])
	if m > n:
		(m, n) = (n, m)
	if m * n <= m + n:
		print('YES')
	else:
		print('NO')
	j += 1


import os, sys
from math import *
t = int(input())
for nc in range(t):
	(a, b) = sorted([int(x) for x in input().strip().split()])
	if a == 1 or (a == 2 and b == 2):
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
import collections
import heapq

def read_line():
	return stdin.readline().strip()

def read_int():
	return int(read_line())

def read_arr():
	return read_line().split(' ')

def read_int_arr():
	return [int(x) for x in read_arr()]

class UnionFind:

	def __init__(self):
		self.sets = {}

	def make_set(self, s):
		if s not in self.sets:
			self.sets[s] = s

	def find(self, s):
		if self.sets[s] != s:
			self.sets[s] = self.find(self.sets[s])
		return self.sets[s]

	def union(self, s1, s2):
		(a, b) = (self.find(s1), self.find(s2))
		if a == b:
			return
		self.sets[a] = b

	def gets_sets(self):
		res = collections.defaultdict(list)
		for s in self.sets:
			res[self.find(s)].append(s)
		return res

class SegmentTree:

	def __init__(self, nums, func):
		self.n = len(nums)
		self.func = func
		self.build(nums)

	def build(self, nums):
		self.segtree = [0 for _ in range(self.n)] + nums
		for i in reversed(range(1, self.n)):
			self.segtree[i] = self.func(self.segtree[i * 2], self.segtree[i * 2 + 1])

	def update(self, i, val):
		p = i + self.n
		self.segtree[p] = val
		while p > 1:
			self.segtree[p // 2] = self.func(self.segtree[p], self.segtree[p ^ 1])
			p //= 2

	def queryRange(self, i, j):
		res = 0
		(i, j) = (i + self.n, j + self.n)
		while i <= j:
			if i % 2 == 1:
				res = self.func(res, self.segtree[i])
				i += 1
			if j % 2 == 0:
				res = self.func(res, self.segtree[j])
				j -= 1
			(i, j) = (i // 2, j // 2)
		return res

def main():
	T = read_int()
	for _ in range(T):
		(n, m) = read_int_arr()
		print('YES' if (n == 1 or m == 1) or (n == 2 and m == 2) else 'NO')
main()


def solve_task(n, m):
	if n == 1 or m == 1 or n == m == 2:
		return 'YES'
	else:
		return 'NO'

def main():
	n_test = int(input())
	solutions = []
	for nt in range(n_test):
		test_case = input()
		split_case = test_case.split()
		n = int(split_case[0])
		m = int(split_case[1])
		solutions.append(solve_task(n, m))
	for s in solutions:
		print(s)
main()


from sys import stdin
for j in range(int(input())):
	[n, m] = [int(x) for x in stdin.readline().split()]
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


for query in range(int(input())):
	nm = input().split()
	n = int(nm[0])
	m = int(nm[1])
	if (n - 1) * m + (m - 1) * n <= m * n:
		print('YES')
	else:
		print('NO')


from math import sqrt
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == 1 or b == 1:
		print('YES')
	elif a == 2 and b == 2:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	s = 0
	(n, m) = map(int, input().split())
	if n == 1:
		s = 1
	if m == 1:
		s = 1
	if m == 2:
		if n == 2:
			s = 1
	if s == 1:
		print('yes')
	else:
		print('no')


from collections import defaultdict as dc
from heapq import *
import math
import bisect
import sys
from collections import deque as dq
from heapq import heapify, heappush, heappop
mod = 10 ** 9 + 7

def inp():
	p = int(input())
	return p

def line():
	p = list(map(int, input().split()))
	return p

def read_mat():
	n = inp()
	a = []
	for i in range(n):
		a.append(line())
	return a

def digit(n):
	s = str(n)
	p = 0
	for i in s:
		p += int(i) ** 2
	return p
ans = 0

def solve(n, m):
	if n == 1 or m == 1:
		return 'YES'
	if n == 2 and m == 2:
		return 'YES'
	return 'NO'
for test in range(inp()):
	(n, m) = line()
	l = solve(n, m)
	print(l)


numTest = int(input())
for _ in range(numTest):
	inputLine = input()
	tempStr = inputLine.split(' ')
	rowNum = int(tempStr[0])
	colNum = int(tempStr[1])
	if rowNum == 1 or colNum == 1:
		print('YES')
	elif rowNum > 2 or colNum > 2:
		print('NO')
	else:
		print('YES')


y = int(input())
ans = []
for i in range(y):
	al = input().split()
	m = list(map(int, al))
	n = min(m[0], m[1])
	k = max(m[1], m[0])
	if n != 1 and k > 2:
		ans.append('NO')
	elif n > 1 and k > 1:
		ans.append('YES')
	elif n == 1:
		ans.append('YES')
for i in ans:
	print(i)


tc = int(input())
while tc > 0:
	(row, col) = map(int, input().split())
	if row == 1 or col == 1 or (row == 2 and col == 2):
		print('YES')
	else:
		print('NO')
	tc -= 1


import sys, math
t = int(sys.stdin.readline())
for T in range(t):
	(n, m) = map(int, sys.stdin.readline().split())
	if n == 2 and m == 2 or n == 1 or m == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for u in range(t):
	(n, m) = map(int, input().split())
	x = 2 * n + 2 * m
	y = 3 * n * m
	z = n * m
	if x + z >= y:
		print('YES')
	else:
		print('NO')


T = int(input().strip())
for t in range(T):
	(n, k) = list(map(int, input().split()))
	(n, k) = (min(n, k), max(n, k))
	if n > 2:
		print('NO')
	elif n == 2:
		if k == 2:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


from math import inf
t = int(input())
for qq in range(t):
	(n, m) = [int(i) for i in input().split()]
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')


ans = []
n = int(input())
for i in range(n):
	s = input()
	a = s.split()
	n = int(a[0])
	m = int(a[1])
	if n == 1 or m == 1:
		ans.append('YES')
	elif n == 2 and m == 2:
		ans.append('YES')
	else:
		ans.append('NO')
for i in ans:
	print(i)


def next():
	return [int(x) for x in input().split()]
(cas,) = next()
for i in range(cas):
	(n, m) = next()
	print('NO' if min(n, m) >= 2 and max(n, m) > 2 else 'YES')


num = int(input())
for _ in range(num):
	(a, b) = [int(i) for i in input().split()]
	if a == 1 or b == 1:
		print('YES')
		continue
	if a * b != 4:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(N, M) = map(int, input().split())
	if N < 2 or M < 2 or (N == 2 and M == 2):
		print('YES')
	else:
		print('NO')


from math import *
from random import *
for t in range(int(input())):
	(n, m) = map(int, input().split())
	if n < m:
		s = n
		n = m
		m = s
	if n == 1:
		print('YES')
	elif n == 2:
		if m > 2:
			print('NO')
		else:
			print('YES')
	elif m == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
res = []
for _ in range(t):
	(n, m) = map(int, input().split())
	(n, m) = (max(n, m), min(n, m))
	if m == 1:
		res.append('YES')
	elif m > 1:
		if n > 2:
			res.append('NO')
		else:
			res.append('YES')
for el in res:
	print(el)


import os
import sys
if os.path.exists('/mnt/c/Users/Square/square/codeforces'):
	f = iter(open('A.txt').readlines())

	def input():
		return next(f)
else:
	input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if n == 1 or k == 1:
		print('YES')
	elif n == 2 and k == 2:
		print('YES')
	else:
		print('NO')


testcases = int(input())
for case in range(testcases):
	nk = input().split(' ')
	n = int(nk[0])
	m = int(nk[1])
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('Yes')
	else:
		print('NO')


q = int(input())
for _ in range(q):
	(m, n) = list(map(int, input().split()))
	edges = n * (m - 1) + m * (n - 1)
	blanks = n * m
	if blanks >= edges:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a + b >= a * b:
		print('YES')
	else:
		print('NO')


test_case = int(input())
my_list = []
for i in range(test_case):
	my_list.append([int(k) for k in input().split()])
for j in range(test_case):
	if my_list[j][0] == 1 or my_list[j][1] == 1:
		print('YES')
	elif my_list[j][0] == 2 and my_list[j][1] == 2:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
for i in range(t):
	row = list(map(int, input().split()))
	if row[0] > row[1]:
		temp = row[0]
		row[0] = row[1]
		row[1] = temp
	if row[0] > 1 and row[1] >= 3:
		print('NO')
	else:
		print('YES')


import sys, random
from bisect import bisect_left, bisect_right
input = sys.stdin.readline

def main():
	inf = 10 ** 20
	t = int(input())
	for _ in range(1, t + 1):
		(n, m) = map(int, input().split())
		if n > m:
			(n, m) = (m, n)
		if n == 1 or (n == 2 and m == 2):
			print('YES')
		else:
			print('NO')
main()


T = int(input())
n = [0] * T
m = [0] * T
ns = [0] * T
for t in range(T):
	(n[t], m[t]) = [int(i) for i in input().split(' ')]
for t in range(T):
	if n[t] == 1 or m[t] == 1 or (n[t] == 2 and m[t] == 2):
		print('YES')
	else:
		print('NO')


n = int(input())
for x in range(n):
	(a, b) = list(map(int, input().split()))
	if 2 * a * b > 2 * (a + b):
		print('NO')
	else:
		print('YES')


def solve(n, m, ans):
	if n == 1 or m == 1:
		ans.append('YES')
		return
	if n == 2 and m == 2:
		ans.append('YES')
		return
	ans.append('NO')

def main():
	t = int(input())
	ans = []
	for i in range(t):
		(n, m) = map(int, input().split())
		solve(n, m, ans)
	for i in ans:
		print(i)
main()


import sys
import time
import math
import collections
start_time = time.time()
yes = 'YES'
no = 'NO'

def solve(tc):
	(n, m) = map(int, input().split())
	if n == 2 and m == 2:
		print(yes)
	elif n == 1 or m == 1:
		print(yes)
	else:
		print(no)
try:
	t = int(input())
	for i in range(t):
		solve(i)
except EOFError:
	pass
sys.stderr.write('**Time -> %.15f fs\n' % (time.time() - start_time))


from sys import setrecursionlimit
from collections import deque
import heapq
import functools

def IntInput():
	return int(input())

def M_IntInput():
	return map(int, input().split())

def M_StrInput():
	return map(int, input().split())

def IntArrayInput():
	return list(map(int, input().split()))

def modInverse(p, a, m):
	return p % m * pow(a % m, m - 2, m) % m

def compare(item1, item2):
	return item2[0] - item1[0] if item1[0] != item2[0] else item1[1] - item2[1]

def DFS(s, n, paths, answer):
	visited = [False] * (n + 1)
	stack = []
	stack.append(s)
	visited[s] = True
	DFSArray = []
	while stack:
		s = stack.pop()
		DFSArray.append(s)
		flag = 0
		for i in paths[s]:
			if visited[i] == False:
				flag = 1
				stack.append(i)
				visited[i] = True
		if not flag:
			answer[s - 1][1] = 0
	while DFSArray != []:
		s = DFSArray.pop()
		if answer[s - 1][1] < 0:
			answer[s - 1][1] = 0
			for i in paths[s]:
				if answer[i - 1][1] >= 0:
					answer[s - 1][1] += answer[i - 1][1] + 1
	return answer

def BFS(s, n, paths, answer):
	visited = [False] * (n + 1)
	answer[s - 1][0] = 0
	queue = deque()
	queue.append(s)
	visited[s] = True
	while queue:
		s = deque.popleft(queue)
		for i in paths[s]:
			if visited[i] == False:
				queue.append(i)
				answer[i - 1][0] = answer[s - 1][0] + 1
				visited[i] = True
	return answer
numbers = ['1110111', '0010010', '1011101', '1011011', '0111010', '1101011', '1101111', '1010010', '1111111', '1111011']
Dict_Numbers = {'1110111': 0, '0010010': 1, '1011101': 2, '1011011': 3, '0111010': 4, '1101011': 5, '1101111': 6, '1010010': 7, '1111111': 8, '1111011': 9}
for _ in range(int(input())):
	(n, m) = M_IntInput()
	if n == 1 or m == 1 or n == m == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print('NYOE S'[a == b == 2 or min(a, b) == 1::2])


import sys
input = sys.stdin.readline
for T in range(int(input())):
	(a, b) = map(int, input().split())
	if a == 1 or b == 1:
		print('YES')
	elif a == b == 2:
		print('YES')
	else:
		print('NO')


I = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	(a, b) = I()
	x = min(a, b)
	if x == 1 or (a == b and a == 2):
		print('YES')
	else:
		print('NO')


k = int(input())
for i in range(k):
	(n, m) = map(int, input().split())
	an = 'YES'
	if (n >= 3 or m >= 3) and n != 1 and (m != 1):
		an = 'NO'
	print(an)


t = int(input())
for tt in range(0, t):
	arr = [int(el) for el in input().split(' ')]
	(m, n) = arr
	if m == 2 and n == 2:
		print('YES')
	elif n == 1 or m == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if k >= 1:
		if n == 1 or k == 1:
			print('YES')
		elif n == 2 and k == 2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def main():
	(n, m) = map(lambda x: int(x), input().split(' '))
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
		return
	print('NO')
t = int(input())
for i in range(t):
	main()


t = int(input(''))
for _ in range(t):
	nm = [int(x) for x in input('').split(' ')]
	if nm[0] == 1 or nm[1] == 1:
		print('YES')
	elif nm[0] == 2 and nm[1] == 2:
		print('YES')
	else:
		print('NO')


from sys import stdin, setrecursionlimit, stdout
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline().rstrip()
res = ['YES', 'NO']
test_case = ii()
while test_case:
	test_case -= 1
	a = li()
	a.sort()
	f = 0
	if a[0] > 1:
		if a[1] > 2:
			f = 1
	print(res[f])


t = int(input())
ans = []
for x in range(t):
	inp = list(map(int, input().split()))
	n = inp[0]
	m = inp[1]
	if n == 1 or m == 1 or (n == 2 and m == 2):
		ans.append('YES')
		continue
	else:
		ans.append('NO')
for a in ans:
	print(a)


import sys
input = sys.stdin.buffer.readline

def I():
	return list(map(int, input().split()))

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a
for __ in range(int(input())):
	(n, m) = I()
	if n == 1 or m == 1:
		print('YES')
	elif n <= 2 and m <= 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	l1 = input().split(' ')
	n = int(l1[0])
	m = int(l1[1])
	if n * m <= n + m:
		print('YES')
	else:
		print('NO')


from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect
import math

def test_case():
	info = list(map(int, input().split()))
	(n, m) = info
	if n == 1 or m == 1:
		return 'YES'
	elif n == 2 and m == 2:
		return 'YES'
	else:
		return 'NO'
for _ in range(int(input())):
	ret = test_case()
	if ret != None:
		print(ret)


t = int(input())
res = []
for _ in range(t):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1 or (m == 2 and n == 2):
		res.append('YES')
	else:
		res.append('NO')
for r in res:
	print(r)


def solution(t):
	for i in range(t):
		nm = input().split()
		(n, m) = (int(nm[0]), int(nm[1]))
		if 3 * n * m - 2 * (n + m) > n * m:
			print('NO')
		else:
			print('YES')
solution(int(input()))


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(n, m) = map(int, sys.stdin.readline().split())
	if min(n, m) >= 2:
		if max(n, m) == 2:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


for t in range(int(input())):
	(n, m) = [int(j) for j in input().split()]
	a = min(n, m)
	b = max(n, m)
	if a == 1:
		print('YES')
	elif a == b == 2:
		print('YES')
	else:
		print('NO')


test_cases = int(input())
for test_case in range(test_cases):
	(n, m) = input().split(' ')
	n = int(n)
	m = int(m)
	if n == 1 and m >= 1:
		print('YES')
	elif m == 1 and n >= 1:
		print('YES')
	elif m == n == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	t -= 1
	(r, c) = map(int, input().split())
	if r == 1 or c == 1 or (r == 2 and c <= 2):
		print('YES')
	else:
		print('NO')


def solution():
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')
for _ in range(int(input())):
	solution()


def method(n, m):
	if m + n >= m * (n - 1) + n * (m - 1):
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(t):
	nm = list(map(int, input().split()))
	n = nm[0]
	m = nm[1]
	method(n, m)


for i in range(int(input())):
	l1 = [int(x) for x in input().split()]
	if l1 == [2, 2]:
		print('YES')
	elif 1 in l1:
		print('YES')
	else:
		print('NO')


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	(n, m) = sep()
	if n == 1 or m == 1 or (n <= 2 and m <= 2):
		print('YES')
		return
	print('NO')
testcase(int(inp()))


def puzzlePieces(n, m):
	if n == 1 or m == 1:
		return 'YES'
	elif n == 2 and m == 2:
		return 'YES'
	return 'NO'
for i in range(int(input())):
	(n, m) = list(map(int, input().split()))
	print(puzzlePieces(n, m))


def main():
	import sys, math
	from collections import defaultdict as dd, deque

	def data():
		return sys.stdin.readline().strip()

	def mdata():
		return list(map(int, data().split()))
	out = sys.stdout.write
	INF = int(1000000000.0)
	mod = int(1000000000.0) + 7
	for i in range(int(data())):
		(n, m) = mdata()
		if n == 1 or m == 1 or n * m == 4:
			print('YES')
		else:
			print('NO')
main()


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	(n, m) = iia()
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


exec(int(input()) * "s={*map(int,input().split())};print('YNEOS'[s!={2}and min(s)>1::2]);")


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	if 1 in [a, b]:
		print('YES')
	elif max(a, b) <= 2:
		print('YES')
	else:
		print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	t = I()
	rr = []
	for _ in range(t):
		(n, m) = LI()
		if min(n, m) == 1 or n * m == 4:
			rr.append('YES')
		else:
			rr.append('NO')
	return JA(rr, '\n')
print(main())


def sol():
	(a, b) = map(int, input().split())
	if a == 2 and b == 2:
		return 'YES'
	if a == 1 or b == 1:
		return 'YES'
	return 'NO'
for i in range(int(input())):
	print(sol())


numCases = int(input())
for a in range(numCases):
	(n, m) = (int(i) for i in input().split(' '))
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


a = int(input())
l = []
for i in range(a):
	(n, m) = list(map(int, input().split(' ')))
	if n == 1 or m == 1:
		l.append('YES')
	elif n == 2 and m == 2:
		l.append('YES')
	else:
		l.append('NO')
for i in range(len(l)):
	if i < len(l) - 1:
		print(l[i])
	else:
		print(l[i], end='')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	sum = (n - 1) * m + n * (m - 1)
	if sum > n * m:
		print('NO')
	else:
		print('YES')


while True:
	try:
		t = eval(input())
		for i in range(t):
			(n, m) = map(int, input().split())
			if n == 1 or m == 1 or (n == 2 and m == 2):
				print('YES')
			else:
				print('NO')
	except:
		break


from collections import defaultdict, Counter
from functools import lru_cache
from heapq import heappush, heappop
from math import gcd, floor, ceil
from sys import stdin, stdout

def ilist():
	return [int(x) for x in stdin.readline().strip().split(' ')]

def iint():
	return int(stdin.readline().strip())

def istr():
	return stdin.readline().strip()

def solve(n, m):
	if n == 1 or m == 1:
		return 'YES'
	if n == 2 and m == 2:
		return 'YES'
	return 'NO'
t = iint()
for _ in range(t):
	(n, m) = ilist()
	print(solve(n, m))


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


def Solve():
	(n, m) = [int(x) for x in input().split()]
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')
T = int(input())
for i in range(T):
	Solve()


def PuzzlePieces(n, m):
	if n == 1 or m == 1 or (n == 2 and m == 2):
		return 'YES'
	else:
		return 'NO'
Lista = []
total = int(input())
for i in range(total):
	All = [int(i) for i in input().split()]
	Lista.append(All)
for j in Lista:
	print(PuzzlePieces(j[0], j[1]))


t = int(input())
i = 0
l = list()
while i < t:
	(n, m) = map(int, input().split())
	l.append(n)
	l.append(m)
	i += 1
j = 0
i = 0
while i < t:
	m = l[j]
	j += 1
	n = l[j]
	j += 1
	if m == 1 or n == 1 or (m == 2 and n == 2):
		print('YES')
	else:
		print('NO')
	i += 1


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	good = False
	if n == 1:
		good = True
	elif m == 1:
		good = True
	elif n == 2 and m == 2:
		good = True
	elif m == 2 and n == 2:
		good = True
	if good:
		print('YES')
	else:
		print('NO')


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for tt in range(int(input())):
	(m, n) = map(int, input().split())
	if n == 2 and m == 2:
		print('YES')
	elif n == 1 or m == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for case in range(t):
	(n, m) = [int(x) for x in input().split()]
	if n == 1 or m == 1 or n == m == 2:
		print('yes')
	else:
		print('no')


from collections import Counter, defaultdict, deque
import sys
input = sys.stdin.readline

def solve():
	(n, m) = [int(x) for x in input().split()]
	total = n * m
	inner = (n - 1) * m + (m - 1) * n
	if inner > total:
		print('NO')
	else:
		print('YES')
tt = int(input())
for test in range(tt):
	solve()


import sys
from math import log2, floor, ceil, sqrt
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(int(ri())):
	(n, m) = Ri()
	if n == 1 or m == 1:
		YES()
	elif n == 2 and m == 2:
		YES()
	else:
		NO()


t = int(input())
for _ in range(t):
	(n, m) = [int(x) for x in input().split()]
	x = (n - 1) * m + (m - 1) * n
	if x > n * m:
		print('NO')
	else:
		print('YES')


tc = int(input().strip())
for t in range(tc):
	(n, m) = map(int, input().strip().split())
	ans = n == 1 or m == 1 or n + m == 4
	if ans:
		print('YES')
	else:
		print('NO')


T = int(input())
for t in range(T):
	(n, m) = list(map(int, input().split()))
	s = min(n, m)
	d = max(n, m)
	res = 'YES'
	if s > 1 and d > 2:
		res = 'NO'
	print(res)


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	t = int(input())
	nums = [list(map(int, input().split())) for x in range(t)]
	for n in nums:
		(r, c) = (n[0], n[1])
		if r == 1 or c == 1 or (r == 2 and c == 2):
			print('Yes')
		else:
			print('No')
main()


t = int(input())
for i in range(t):
	(n, m) = [int(c) for c in input().split()]
	blank = n * m
	shared = 2 * m * n - (m + n)
	res = blank >= shared and 'YES' or 'NO'
	print(res)


import math
t = int(input())
for z in range(t):
	(n, m) = [int(i) for i in input().split()]
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


for ia in range(int(input())):
	(m, n) = map(int, input().split())
	if m == 2 and n == 2:
		print('YES')
		continue
	elif m == 1 or n == 1:
		print('YES')
	else:
		print('NO')


def main():
	n_t = int(input())
	for t in range(n_t):
		(n, m) = map(int, input().split(' '))
		ans = 'NO'
		if n == 1 or m == 1 or (m == 2 and n == 2):
			ans = 'YES'
		print(ans)
main()


import sys
I = sys.stdin.readline
ans = ''
for _ in range(int(I())):
	(n, m) = map(int, I().split())
	if (n == 1 or m == 1) or (n == 2 and m == 2):
		ans += 'YES\n'
	else:
		ans += 'NO\n'
print(ans)


def main():
	for case in range(int(input())):
		(n, m) = [int(x) for x in input().split()]
		if n == 1 or m == 1:
			print('YES')
		elif n == 2 and m == 2:
			print('YES')
		else:
			print('NO')
	return
main()


from sys import stdin

def solve(tc):
	(n, m) = map(int, stdin.readline().split())
	if n == 1 or m == 1:
		print('YES')
		return
	elif n == 2 and m == 2:
		print('YES')
		return
	print('NO')
LOCAL_TEST = not __debug__
if LOCAL_TEST:
	infile = __file__.split('.')[0] + '-test.in'
	stdin = open(infile, 'r')
tcs = int(stdin.readline().strip())
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


t = int(input())
for test in range(t):
	(n, m) = [int(x) for x in input().split()]
	if n == 2 and m == 2:
		print('YES')
		continue
	if n == 1 or m == 1:
		print('YES')
	else:
		print('NO')


t = int(input())

def same(a, b):
	if a == 1 and b >= 1:
		print('YES')
	elif b == 1 and a >= 1:
		print('YES')
	elif a == 2 and b == 2:
		print('YES')
	else:
		print('NO')
while t > 0:
	(m, n) = input().split(' ')
	m = int(m)
	n = int(n)
	same(m, n)
	t -= 1


t = int(input())
l = list()
for i in range(t):
	x = input().split(' ')
	n = int(x[0])
	m = int(x[1])
	if n * m >= (n - 1) * m + (m - 1) * n:
		l.append('YES')
	else:
		l.append('NO')
for e in l:
	print(e)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if x == 1:
		print('Yes')
	elif y == 1:
		print('Yes')
	elif x == 2 and y == 2:
		print('Yes')
	else:
		print('No')


tests = int(input())
for _ in range(tests):
	(x, y) = list(map(int, input().split()))
	if x == 1 or y == 1 or x * y == 4:
		print('YES')
	else:
		print('NO')


for j in range(int(input())):
	n = list(map(int, input().split()))
	if 1 in n:
		print('YES')
	elif n == [2, 2]:
		print('YES')
	else:
		print('NO')


import sys, math
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n == 2 and k == 2:
		print('YES')
	elif min(n, k) == 1:
		print('YES')
	else:
		print('NO')


a = int(input())
for e in range(a):
	(n, m) = [int(x) for x in input().split()]
	if (n == 1 or m == 1) or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')


def compute(m, n):
	if m == 2 and n == 2:
		print('YES')
	elif m == 1 or n == 1:
		print('YES')
	else:
		print('NO')
testcases = int(input())
for i in range(testcases):
	s = input()
	l = list(map(int, s.split()))
	compute(l[0], l[1])


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


def read_int():
	n = int(input())
	return n

def read_ints():
	ints = [int(x) for x in input().split(' ')]
	return ints

def solve(n, m):
	if n + m > 4:
		if n == 1 or m == 1:
			return 'YES'
		return 'NO'
	else:
		return 'YES'
t = read_int()
for case in range(t):
	(n, m) = read_ints()
	sol = solve(n, m)
	print(sol)


def answer():
	n = int(input())
	while n:
		a = [int(x) for x in input().split()]
		if 1 in a:
			print('YES')
		elif a == [2, 2]:
			print('YES')
		else:
			print('NO')
		n -= 1
answer()


def main():
	k = int(input())
	for q in range(k):
		(n, m) = map(int, input().split())
		if n * m <= n + m:
			print('YES')
		else:
			print('NO')
main()


from collections import defaultdict as dfd
import math
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
	elif n > 2 or m > 2:
		print('NO')
	else:
		print('YES')


import sys
import math as mt
input = sys.stdin.buffer.readline
t = int(input())
for __ in range(t):
	(n, m) = map(int, input().split())
	n1 = min(n, m)
	m1 = max(n, m)
	if n1 == 1:
		print('YES')
	elif n1 == 2 and m1 == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(1, t + 1):
	(r, c) = map(int, input().split())
	if r == 2 and c == 2:
		print('Yes')
	elif r >= 2 and c >= 2:
		print('No')
	else:
		print('Yes')


t = int(input())
for x in range(t):
	(a, b) = map(int, input().split(' '))
	if min(a, b) == 1 or max(a, b) < 3:
		print('YES')
	else:
		print('NO')


def main():
	n_num = int(input())
	for k in range(n_num):
		(a, b) = list(map(int, input().split(' ')))
		if a == 1 or b == 1 or (a == 2 and b == 2):
			print('YES')
		else:
			print('NO')
main()


n_tests = int(input())
for _ in range(n_tests):
	(n, m) = [int(x) for x in input().split(' ')]
	if n > 2 and m > 1 or (m > 2 and n > 1):
		print('NO')
	else:
		print('YES')


t = int(input())

def solve(a, b):
	if a == 1 or b == 1:
		return True
	if a == 2 and b == 2:
		return True
	return False
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	print('YES' if solve(a, b) else 'NO')


def met(n, m):
	if n == 1 or m == 1:
		return 'YES'
	if n == m == 2:
		return 'YES'
	return 'NO'
n = int(input())
for i in range(n):
	(a, b) = tuple(map(int, input().split(' ')))
	print(met(a, b))


from collections import deque
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def solve():
	for _ in range(ii()):
		(n, m) = mi()
		f = 0
		if n == 1 or m == 1:
			f = 1
		if n == 2 and m == 2:
			f = 1
		if f:
			print('YES')
		else:
			print('NO')
solve()


try:
	k = int(input())
	for i in range(k):
		z = list(map(int, input().split()))
		a = (z[0] - 1) * z[1] + (z[1] - 1) * z[0]
		b = z[0] * z[1]
		if a <= b:
			print('YES')
		else:
			print('NO')
except Exception:
	pass


t = int(input())
while t > 0:
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
	elif m * n == 4:
		print('YES')
	else:
		print('NO')
	t = t - 1


testCases = int(input())
for i in range(0, testCases):
	inputElements = input().split()
	row = int(inputElements[0])
	col = int(inputElements[1])
	if row == 1 or col == 1:
		print('YES')
	elif row == 2 and col == 2:
		print('YES')
	else:
		print('NO')


import sys
from math import ceil
from itertools import islice, cycle
from collections import Counter, defaultdict
stdin = sys.stdin
t = stdin.readline().strip()
t = int(t)
for test_idx in range(t):
	(n, m) = stdin.readline().strip().split()
	n = int(n)
	m = int(m)
	(n, m) = sorted([n, m])
	if n == 2 and m == 2:
		print('YES')
		continue
	if n >= 2:
		print('NO')
		continue
	print('YES')


def solve():
	T = int(input())
	for i in range(T):
		(a, b) = map(int, input().split())
		if a == 1 or b == 1 or a * b == 4:
			print('YES')
		else:
			print('NO')
solve()


x = int(input())
for i in range(x):
	(n, m) = map(int, input().split())
	if n == 2 and m == 2:
		print('YES')
	elif n >= 2 and m >= 2:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	(m, n) = map(int, input().split())
	if m == 1 or n == 1:
		print('YES')
	elif m + n < 5:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t = t - 1
	(n, k) = map(int, input().split())
	if n == 1 or k == 1 or (n == 2 and k == 2):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	s = input().split()
	a = int(s[0])
	b = int(s[1])
	if a == 2 and b == 2:
		print('YES')
		continue
	elif a == 1 or b == 1:
		print('YES')
	else:
		print('NO')


testcases = int(input())
for i in range(testcases):
	(n, k) = list(map(int, input().split()))
	if n == 1 or k == 1:
		print('YES')
	elif n == k == 2:
		print('YES')
	else:
		print('NO')


import sys
import math
from math import factorial as f
from collections import defaultdict as dd
mod = 1000000007
T = 1
T = int(sys.stdin.readline())
for _ in range(T):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('Yes')
	else:
		print('NO')


import math

def main():
	for q in range(int(input())):
		(N, M) = map(int, input().split())
		if (N - 1) * M + (M - 1) * N <= M * N:
			print('YES')
		else:
			print('NO')
main()


kl = int(input())
for l in range(kl):
	(m, n) = map(int, input().split())
	if m == 1 or n == 1 or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	(m, n) = map(int, input().split())
	if m * n - (m + n) <= 0:
		print('YES')
	else:
		print('NO')
	t -= 1


T = int(input())
for t in range(T):
	(N, M) = map(int, input().split())
	if N == 2 and M == 2:
		print('YES')
	elif N == 1 or M == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t != 0:
	t = t - 1
	m = 0
	numbers = input()
	list = numbers.split(' ')
	mellow = list[0]
	yellow = list[1]
	if mellow == '1' or yellow == '1':
		print('YES')
	elif mellow == '2' and yellow == '2':
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	(n, m) = sorted(map(int, input().split()))
	if n == 1 or n == m == 2:
		print('YES')
	else:
		print('NO')
	t = t - 1


q = int(input())
for i in range(q):
	(n, m) = list(map(int, input().split()))
	if n == 1 or m == 1:
		print('YES')
	elif n == m == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if n == 1 or k == 1 or n * k == 4:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	(r, c) = list(map(int, stdin.readline().split()))
	if r == c == 2 or (r == 1 or c == 1):
		print('YES')
	else:
		print('NO')


t = int(input())
ans = []
while t > 0:
	t = t - 1
	s = input()
	s1 = s.split(' ')
	n = int(s1[0])
	m = int(s1[1])
	if m * n > m + n:
		ans.append('NO')
	else:
		ans.append('YES')
for i in range(len(ans)):
	print(ans[i])


import sys

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
t = int(input())
while t > 0:
	t -= 1
	(n, m) = map(int, input().split())
	if n * m > 4 and min(n, m) > 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(n1, m1) = input().split()
	n = int(n1)
	m = int(m1)
	if n == 1 or m == 1 or (n, m) == (2, 2):
		print('YES')
	else:
		print('NO')


s = input()
while True:
	try:
		(a, b) = map(int, input().split(' '))
		if a == 1 or b == 1 or (a == 2 and b == 2):
			print('YES')
		else:
			print('NO')
	except:
		break


for i in range(int(input())):
	l = list(map(int, input().split()))
	if l[1] == 2 and l[0] == 2:
		print('YES')
	elif l[1] == 1 or l[0] == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for T in range(t):
	(n, m) = [int(x) for x in input().split()]
	if n > m:
		(n, m) = (m, n)
	if n == 1 or n == m == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for case in range(t):
	(n, m) = map(int, input().split())
	perimeter = 2 * n + 2 * m
	inside = m * (n - 1) + n * (m - 1)
	nobs = 2 * n * m
	if nobs > perimeter:
		print('NO')
	else:
		print('YES')


def py(n):
	if n + m <= 4 or n == 1 or m == 1:
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(t):
	(n, m) = [int(i) for i in input().split()]
	ans = py(n)
	ans


import sys
ints = (int(x) for x in sys.stdin.read().split())
sys.setrecursionlimit(3000)

def main():
	ntc = next(ints)
	for tc in range(ntc):
		(n, m) = (next(ints) for i in range(2))
		print('YES' if n == 1 or m == 1 or n == m == 2 else 'NO')
	return
main()


import sys
input = sys.stdin.readline
t = int(input())
import math
for t1 in range(t):
	(a, b) = list(map(int, input().split(' ')))
	if a == 1 or b == 1:
		print('YES')
	elif a == 2 and b == 2:
		print('YES')
	else:
		print('NO')


tc = int(input())
for _ in range(tc):
	(n, m) = map(int, input().split())
	if m == 1 or n == 1:
		print('YES')
	elif n * m <= 5:
		print('YES')
	else:
		print('NO')


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	(H, W) = MAP()
	if H == 1 or W == 1 or (H == 2 and W == 2):
		YES()
	else:
		NO()


testCases = int(input())
for _ in range(testCases):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
	elif n < 3 and m < 3:
		print('YES')
	else:
		print('NO')


N = int(input())
for x in range(N):
	init = input().split()
	n = int(init[0])
	m = int(init[1])
	if n == 1 or m == 1:
		print('YES')
	elif n <= 2 and m <= 2:
		print('YES')
	else:
		print('NO')


t = int(input())
while t != 0:
	(n, m) = map(int, input().split())
	p = min(n, m)
	q = max(n, m)
	if p == 1 or (p == 2 and p == q):
		print('YES')
	else:
		print('NO')
	t -= 1


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
import bisect as bi
import heapq

def I():
	return int(input())

def In():
	return map(int, input().split())

def main():
	try:
		(a, b) = In()
		if a == 2 and b == 2:
			print('YES')
		elif a == 1 or b == 1:
			print('YES')
		else:
			print('NO')
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


from math import ceil
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == 1 or b == 1:
		print('yes')
	elif a == b and a == 2:
		print('yes')
	else:
		print('no')


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	o = n * (m - 1) + m * (n - 1)
	if o <= m * n:
		print('YES')
	else:
		print('NO')


t = int(input())
if 1 <= t <= 1000:
	for i in range(t):
		(m, n) = input().split()
		m = int(m)
		n = int(n)
		if n == 1 and m <= 10 ** 5:
			print('yes')
		elif n == 2 and m <= 2:
			print('yes')
		elif n <= 10 ** 5 and m == 1:
			print('yes')
		else:
			print('no')


for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	if a > 2 and b >= 2 or (b > 2 and a >= 2):
		print('NO')
	else:
		print('YES')


def main():
	(n, m) = map(int, input().split())
	if n == 2 and m == 2:
		print('YES')
	elif n == 1 or m == 1:
		print('YES')
	else:
		print('NO')

def __starting_point():
	t = int(input())
	for i in range(t):
		main()
__starting_point()


t = int(input())
lista = []
for i in range(t):
	(x, y) = [int(q) for q in input().split()]
	if 2 * x * y > 2 * x + 2 * y:
		lista.append('NO')
	else:
		lista.append('YES')
for i in lista:
	print(i)


n = int(input())
for i in range(n):
	(p, q) = map(int, input().split())
	if p == 1 or q == 1:
		print('YES')
	elif p == 2 and q == 2:
		print('YES')
	else:
		print('NO')


for _ in [0] * int(input()):
	(m, n) = list(map(int, input().split()))
	if (m == 1 or n == 1) or (m == 2 and n == 2):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
import heapq
import copy
import math

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def bin_search(arr, l, r, val):
	if arr[r] <= val:
		return r + 1
	if r - l < 2:
		if arr[l] > val:
			return l
		else:
			return r
	mid = int((l + r) / 2)
	if arr[mid] <= val:
		return bin_search(arr, mid, r, val)
	else:
		return bin_search(arr, l, mid, val)

def pr_list(a):
	print(*a, sep=' ')

def find_permut(hashm, l):
	ans = 1
	total = math.factorial(l)
	for i in hashm:
		if i != 0:
			ans = ans * math.factorial(i)
	return int(total / ans)

def main():
	tests = inp()
	mod = 1000000007
	limit = 10 ** 18
	for test in range(tests):
		[n, m] = inlt()
		if min(n, m) == 1:
			print('YES')
		elif m == 2 and n == 2:
			print('YES')
		else:
			print('NO')
	return 0
main()


t = int(input())
for case in range(t):
	(n, m) = map(int, input().split())
	ans = 'NO'
	if n == m == 2:
		ans = 'YES'
	elif n == 1 or m == 1:
		ans = 'YES'
	print(ans)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a == 1 or b == 1 or (a == 2 and b == 2):
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('yes')
	elif n == 2 and m == 2:
		print('yes')
	else:
		print('no')


def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))

def solve():
	(n, m) = rl()
	if min(n, m) == 1 or max(n, m) == 2:
		print('YES')
		return
	print('NO')
t = ri()
for i in range(t):
	solve()


import math
n = int(input())
for i in range(n):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	if min(a, b) == 1 or a * b == 4:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, input().split())
		if n > m:
			(n, m) = (m, n)
		if n == 1:
			print('YES')
		elif n == 2:
			if m <= 2:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	return
main()


import sys
import math

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]
t = int(input())
for q in range(t):
	(n, m) = inputnums()
	if n == 2 and m == 2:
		print('YES')
	elif n == 1 or m == 1:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
for i in range(t):
	sa = input().split(' ')
	if '1' in sa:
		print('Yes')
		continue
	elif sa[0] == '2' and sa[1] == '2':
		print('Yes')
	else:
		print('No')


from math import *
from sys import stdin, stdout
for __ in range(int(input())):
	(n, m) = map(int, input().split())
	if min(n, m) <= 1 or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')


from collections import deque
from collections import OrderedDict
import math
import sys
import os
from io import BytesIO
for t in range(int(input())):
	(n, m) = map(int, input().split())
	if n == 2 and m == 2:
		print('YES')
	elif n == 1 or m == 1:
		print('YES')
	else:
		print('NO')


tests = int(input())
for i in range(tests):
	(m, n) = map(int, input().split())
	if m == 1 or n == 1:
		print('YES')
	elif m == 2 and n == 2:
		print('YES')
	else:
		print('NO')


import math

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
t = inp()
while t:
	(a, b) = invr()
	if a == 1 or b == 1:
		print('YES')
	elif a == 2 and b == 2:
		print('YES')
	else:
		print('NO')
	t -= 1


def solver(n, m):
	if n == 1 or m == 1:
		return 'YES'
	elif n == 2 and m == 2:
		return 'YES'
	else:
		return 'NO'
t = int(input())
while t > 0:
	t -= 1
	inp = input().split(' ')
	n = int(inp[0])
	m = int(inp[1])
	print(solver(n, m))


numt = int(input())
for fuioi in range(numt):
	lst = input().split()
	lst = [int(k) for k in lst]
	n_con = (lst[0] - 1) * lst[1] + (lst[1] - 1) * lst[0]
	n_p = lst[0] * lst[1]
	if n_p >= n_con:
		print('YES')
	else:
		print('NO')


t = int(input())
while t != 0:
	(a, b) = [int(i) for i in input().split()]
	if a == 1 or b == 1:
		print('YES')
	elif a == 2 and b == 2:
		print('YES')
	else:
		print('NO')
	t = t - 1


import math

def get_num():
	return list(map(int, input().rstrip().split()))

def rotate(my_list, num):
	return my_list[num:] + my_list[:num]

def main():
	num = int(input())
	for i in range(num):
		mynum = get_num()
		if mynum[0] == 1 or mynum[1] == 1:
			print('YES')
		elif mynum[0] == 2 and mynum[1] == 2:
			print('YES')
		else:
			print('NO')
main()


import math
from sys import stdin, stdout
from heapq import heapify, heappop, heappush
from collections import Counter
T = int(stdin.readline())
for i in range(T):
	(n, m) = list(map(int, stdin.readline().split()))
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for x in range(t):
	wejscie = str(input())
	(a, b) = wejscie.split()
	a = int(a)
	b = int(b)
	if a == 1 or b == 1:
		print('YES')
	elif a <= 2 and b <= 2:
		print('YES')
	else:
		print('NO')


def main():
	(m, n) = map(int, input().split())
	if m * n <= 4 or n == 1 or m == 1:
		print('YES')
	else:
		print('NO')
t = int(input())
while t:
	main()
	t -= 1


t = int(input())
for i in range(t):
	(n1, m1) = input().split(' ')
	n = int(n1)
	m = int(m1)
	if n == 1:
		print('YES')
	elif m == 1:
		print('YES')
	elif n == m == 2:
		print('YES')
	else:
		print('NO')


inp = input()
num_cases = int(inp)
for _ in range(num_cases):
	(m, n) = list(map(int, input().split()))
	if m == 1 or n == 1:
		print('YES')
		continue
	if m == 2 and n == 2:
		print('YES')
		continue
	print('NO')


t = int(input())
while t:
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	if x >= 3 and y > 1 or (y >= 3 and x > 1):
		print('NO')
	else:
		print('YES')
	t -= 1


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


from typing import List

def jigsaw():
	(n, m) = map(int, input().split())
	if (n == 1 or m == 1) or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(t):
	jigsaw()


t = int(input())
a = [0] * t
for i in range(t):
	(n, m) = map(int, input().split())
	if n == m == 2:
		a[i] = 'YES'
		continue
	elif n > 1 and m > 1:
		a[i] = 'NO'
	else:
		a[i] = 'YES'
for x in a:
	print(x)


import sys
I = sys.stdin.readline
pr = sys.stdout.write

def main():
	for _ in range(int(I())):
		(n, m) = map(int, I().split())
		if min(n, m) == 1 or (n == 2 and m == 2):
			pr('YES\n')
		else:
			pr('NO\n')
main()


a = int(input())
b = []
for i in range(a):
	b.append(list(map(int, input().split())))
for i in range(a):
	c = b[i][0] * b[i][1] * 4
	d = 2 * (b[i][0] + b[i][1])
	e = c - d
	f = b[i][0] * b[i][1]
	if f >= int(e / 2):
		print('YES')
	else:
		print('NO')


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
for _ in range(ii()):
	(n, m) = mi()
	if n == 1 or m == 1 or (m == 2 and n == 2):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	s = [int(i) for i in input().strip().split()]
	if s[0] == 1 or s[1] == 1:
		print('YES')
	elif s[0] * s[1] == 4:
		print('YES')
	else:
		print('NO')


test = int(input())
while test > 0:
	(n, m) = [int(x) for x in input().split()]
	if n is 1 or m is 1 or (n is 2 and m is 2):
		print('YES')
	else:
		print('NO')
	test -= 1


def sol(a, b):
	if a == b or a == 4:
		return 1
	return 0
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print('YES') if sol(n * m, max(n, m)) == 1 else print('NO')


from sys import stdin, stdout

def main():
	for _ in range(int(stdin.readline())):
		(n, m) = map(int, input().split())
		if n == 1 or m == 1:
			print('YES')
		elif n == 2 and m == 2:
			print('YES')
		else:
			print('NO')
main()


from sys import stdin, stdout
import bisect

def st():
	return list(stdin.readline())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
			n = n - 1
		else:
			a = a * a
			n = n >> 1
	return r

def solve():
	(n, m) = mp()
	if n == 1 or m == 1 or (n == 2 and m == 2):
		pr('YES')
	else:
		pr('NO')
for _ in range(inp()):
	solve()


def single_integer():
	return int(input())

def multi_integer():
	return map(int, input().split())

def string():
	return input()

def multi_string():
	return input().split()
k = single_integer()
for i in range(k):
	(n, m) = multi_integer()
	if max(n, m) >= 3:
		if min(n, m) >= 2:
			print('NO')
		else:
			print('YES')
	else:
		print('YES')


t = int(input())
for i in range(t):
	(n, m) = [int(x) for x in input().split()]
	if n == 1 or m == 1:
		print('yes')
		continue
	if n == 2 and m == 2:
		print('yes')
		continue
	print('no')


t = int(input())
for i in range(t):
	(m, n) = map(int, input().strip().split(' '))
	c = m * (n - 1) + n * (m - 1)
	d = m * n
	if d >= c:
		print('YES')
	else:
		print('NO')


l = []
for i in range(int(input())):
	(a, b) = input().split(' ')
	if (a == '1' or b == '1') or (a == '2' and b == '2'):
		l.append('YES')
	else:
		l.append('NO')
for i in l:
	print(i)


for x in range(int(input())):
	(a, b) = map(int, input().split())
	if a == 1 or b == 1:
		print('YES')
	elif a < 3 and b < 3:
		print('YES')
	else:
		print('NO')


from sys import stdin, exit, setrecursionlimit
from collections import deque
setrecursionlimit(10000000)
input = stdin.readline
lmi = lambda : list(map(int, input().split()))
mi = lambda : map(int, input().split())
si = lambda : input().strip('\n')
ssi = lambda : input().strip('\n').split()
for _ in range(int(input())):
	(n, m) = mi()
	if n == 1 or m == 1 or n == 2 == m:
		print('YES')
	else:
		print('NO')


for ad in range(int(input())):
	(x, y) = list(map(int, input().split()))
	a = min(x, y)
	b = max(x, y)
	if a == 1:
		print('YES')
	elif a == 2 and b == 2:
		print('YES')
	else:
		print('NO')


n = int(input())
while n > 0:
	s = input().split(' ')
	a = int(s[0])
	b = int(s[1])
	if a == 2 and b == 2 or (a == 1 or b == 1):
		print('YES')
	else:
		print('NO')
	n -= 1


for _ in range(int(input())):
	(n, m) = list(map(int, input().split()))
	res = 'NO'
	if n == 1 or m == 1 or (n == 2 and m == 2):
		res = 'YES'
	print(res)


t = int(input())
for inh in range(0, t):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	x = list(map(int, input().split()))
	if min(x) == 1 or max(x) == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for tt in range(t):
	(N, M) = [int(x) for x in input().split(' ')]
	n = min(N, M)
	m = max(N, M)
	if n == 1:
		print('YES')
	elif n == 2:
		if m <= 2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math
nb_cases = int(input())
for c in range(nb_cases):
	(n, m) = [int(x) for x in input().split()]
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(n, m) = map(int, input().split())
	total_edges = n * m * 4
	total_outer_edges = n * 2 + m * 2
	joined_edges = total_edges - total_outer_edges
	if n * m >= joined_edges // 2:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input().strip()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())

def from_file(f):
	return f.readline
t = inp()
for _ in range(t):
	(n, m) = invr()
	if (n == 1 or m == 1) or (m == 2 and n == 2):
		print('YES')
	else:
		print('NO')


import sys
try:
	sys.stdin = open('Input.txt', 'r')
	sys.stdout = open('Output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for testCases in range(int(input())):
	(a, b) = map(int, input().split())
	if a == 1 or b == 1:
		print('YES')
	elif a == 2 and b == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	arr = list(map(int, input().strip().split()))[:2]
	(n, m) = (arr[0], arr[1])
	if n == 1 or (n == 2 and m == 2) or m == 1:
		print('YES')
	else:
		print('NO')
	t -= 1


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = int(input())
for tt in range(t):
	(n, m) = map(int, sys.stdin.readline().split(' '))
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


from sys import stdin
input = stdin.readline
import bisect
import math
for xoxo in range(1):
	for _ in range(int(input())):
		(r, c) = map(int, input().split())
		if r == 2 and c == 2 or (r < 2 or c < 2):
			print('YES')
		else:
			print('NO')


t = int(input())
for y in range(t):
	(r, c) = map(int, input().split())
	if r == 1 or c == 1 or r * c == 4:
		print('YES')
	else:
		print('NO')


answer_list = []
trails = int(input())
for x in range(trails):
	numbers = input()
	numbers = numbers.split()
	numbers_list = []
	for g in numbers:
		numbers_list.append(int(g))
	n = numbers_list[0]
	m = numbers_list[1]
	multiple = n * m
	sum_n_m = n + m
	eges = 2 * multiple - sum_n_m
	if eges <= multiple:
		answer_list.append('YES')
	else:
		answer_list.append('NO')
for q in answer_list:
	print(q)


def check(n, m):
	if n == 1 or m == 1 or (n == 2 and m == 2):
		return 'YES'
	else:
		return 'NO'
for i in range(int(input())):
	(n, m) = input().split(' ')
	n = int(n)
	m = int(m)
	result = check(n, m)
	print(result)


num_cases = int(input())
for _ in range(num_cases):
	case_ln = input().split(' ')
	n = int(case_ln[0])
	m = int(case_ln[1])
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(m, n) = list(map(int, input().split()))
	if min(n, m) == 1 or (m == 2 and n == 2):
		print('YES')
	else:
		print('NO')


t = int(input())

def fn():
	(n, m) = map(int, input().split())
	if n == 1 or m == 1 or (n == m and n == 2):
		print('YES')
	else:
		print('NO')
while t:
	t -= 1
	fn()


for i in range(int(input())):
	(n, m) = map(int, input().split())
	if max(n, m) >= 3 and min(n, m) >= 2:
		print('NO')
	else:
		print('YES')


k = int(input())
for j in range(k):
	(x, y) = [int(i) for i in input().split()]
	if x == y and x == 2 or x == 1 or y == 1:
		print('YES')
	else:
		print('NO')


from math import inf, sqrt, floor, ceil
from collections import Counter, defaultdict, deque
from heapq import heappush as hpush, heappop as hpop, heapify as h
from operator import itemgetter
from itertools import product
from bisect import bisect_left, bisect_right
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	t -= 1
	arr = [int(x) for x in input().split()]
	if arr[0] == 1 or arr[1] == 1:
		print('YES')
	elif arr[0] == 2 and arr[1] == 2:
		print('YES')
	else:
		print('NO')


import sys

def read_int():
	return int(sys.stdin.readline())

def read_ints():
	return list(map(int, sys.stdin.readline().split()))
t = read_int()
for j in range(t):
	(m, n) = read_ints()
	n_internal = (m - 1) * n + (n - 1) * m
	if n_internal <= m * n:
		print('YES')
	else:
		print('NO')


import getopt
import sys
onlyCase = -1
verbose = False
try:
	(opts, args) = getopt.getopt(sys.argv[1:], 'vc:', ['case='])
except getopt.GetoptError as err:
	print(str(err))
	sys.exit(2)
for (o, a) in opts:
	if o in ('-c', '--case'):
		onlyCase = int(a)
	elif o == '-v':
		verbose = True
	else:
		sys.exit()
ncases = int(input())
for c in range(1, ncases + 1):
	(N, M) = [int(x) for x in input().split()]
	if onlyCase != -1 and onlyCase != c:
		continue
	if N == 1 or M == 1 or (N == 2 and M == 2):
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	y = [int(i) for i in input().split()]
	if 1 in y:
		print('YES')
	elif y[0] >= 3 or y[1] >= 3:
		print('NO')
	else:
		print('YES')


for g in range(int(input())):
	(n, m) = map(int, input().split())
	if n > m:
		(n, m) = (m, n)
	if n == 1:
		print('YES')
	elif n == m == 2:
		print('YES')
	else:
		print('NO')


t = int(input())

def solve(n, m):
	pieces = n * m
	if n == 1 or m == 1:
		return 'YES'
	elif n == 2 and m == 2:
		return 'YES'
	else:
		return 'NO'
for _ in range(t):
	(n, m) = list(map(int, input().split()))
	print(solve(n, m))


z = int(input())
for h in range(z):
	(a, b) = map(int, input().split())
	if a == 1 or b == 1:
		print('YES')
	elif a == 2 and b == 2:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	(l, r) = map(int, input().split())
	if l * r <= 4:
		print('YES')
	elif l == 1 or r == 1:
		print('YES')
	else:
		print('NO')


def solve():
	(n, m) = map(int, input().split())
	if n >= 2 and m >= 2 and (not (m == 2 and n == 2)):
		print('No')
	else:
		print('Yes')
for i in range(int(input())):
	solve()


t = int(input())
for tc in range(t):
	s = input().split()
	(n, m) = (int(s[0]), int(s[1]))
	mi = min(n, m)
	if mi == 1:
		print('YES')
	elif n * m <= 4:
		print('YES')
	else:
		print('NO')


t = int(input())
for i10 in range(t):
	(n, m) = list(map(int, input().split()))
	if n == 1 or m == 1 or n + m == 4:
		print('YES')
	else:
		print('NO')


def solve():
	(n, m) = map(int, input().split())
	if n == 1 or m == 1 or max(n, m) <= 2:
		return 'YES'
	return 'NO'
tests = int(input())
for _ in range(tests):
	print(solve())


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if max(x, y) > 2 and min(x, y) > 1:
		print('NO')
	else:
		print('YES')


class solution:

	def __init__(self, n, m):
		self.n = n
		self.m = m
		self.answer = ''

	def calculation(self):
		RANGE_NUM = 2
		if self.n == RANGE_NUM and self.m == RANGE_NUM:
			self.answer = 'YES'
		elif self.n < RANGE_NUM or self.m < RANGE_NUM:
			self.answer = 'YES'
		else:
			self.answer = 'NO'
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	root = solution(n, m)
	root.calculation()
	print(root.answer)


def can_solve(n, m):
	if n == 1 or m == 1:
		return True
	if (n, m) == (2, 2):
		return True
	return False
number_of_tests = int(input())
for _ in range(number_of_tests):
	(n, m) = map(int, input().split())
	result = can_solve(n, m)
	print('YES' if result else 'NO')


for x in range(int(input())):
	(n, m) = map(int, input().strip().split()[:2])
	if n == 1 or m == 1:
		print('YES')
	elif n == 2:
		if m <= 2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
while t > 0:
	t -= 1
	a = input().split(' ')
	x = int(a[0])
	y = int(a[1])
	if x == 1 or y == 1:
		print('YES')
	elif x == 2 and y <= 2 or (x <= 2 and y == 2):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	inp = list(map(int, input().split()))
	n = inp[0]
	m = inp[1]
	if m == 1 or n == 1:
		print('YES')
	elif m == 2 and n == 2:
		print('YES')
	else:
		print('NO')


for _ in [*open(0)][1:]:
	(a, b) = map(int, _.split())
	print('NYOE S'[a == 1 or b == 1 or a == b == 2::2])


import sys
import math
from collections import defaultdict

def solve(test):
	(n, m) = map(int, input().split())
	if n == 2 and m == 2:
		print('YES')
	elif n == 1:
		print('YES')
	elif m == 1:
		print('YES')
	else:
		print('NO')
test_cases = int(input())
for t in range(1, test_cases + 1):
	solve(t)


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key, lru_cache
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip().split()]

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(i) for i in input().rstrip()]
for _ in range(val()):
	(a, b) = li()
	if a == b == 2:
		print('YES')
	elif a == 1 or b == 1:
		print('YES')
	else:
		print('NO')


import sys
readline = sys.stdin.readline

def solve():
	(N, M) = map(int, readline().split())
	if N == 1 or M == 1 or (N == 2 and M == 2):
		print('YES')
	else:
		print('NO')
T = int(readline())
for i in range(T):
	solve()


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
mod = 1000000007
import math
import bisect
abc = 'abcdefghijklmnopqrstuvwxyz'

def main():
	for _ in range(ii()):
		(n, m) = mi()
		if n == 1 or m == 1:
			print('YES')
		elif n == m == 2:
			print('YES')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	c = inp()
	for i in range(c):
		(a, b) = inlt()
		d = (a - 1) * b + a * (b - 1)
		if d <= a * b:
			print('YES')
		else:
			print('NO')
main()


from sys import stdin, stdout
input = stdin.readline
print = stdout.write
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == 1 or b == 1 or (a <= 2 and b <= 2):
		print('YES\n')
	else:
		print('NO\n')


from sys import stdin, stdout
from math import *
from heapq import *
from collections import *

def main():
	ntest = int(stdin.readline())
	for testcase in range(ntest):
		(n, m) = [int(x) for x in stdin.readline().split()]
		a = (n, m) if n <= m else (m, n)
		ans = 'NO'
		if a in [(1, 1), (1, 2), (1, 3), (2, 2)] or min(n, m) < 2:
			ans = 'YES'
		stdout.write('%s\n' % ans)
	return 0
main()


MOD = 1000000007

def solve(n, m):
	if n == 1 or m == 1 or (m == 2 and n == 2):
		return True
	else:
		return False
for i in range(int(input())):
	(n, m) = map(int, input().split())
	pt = solve(n, m)
	print('YES' if pt == True else 'NO')


t = int(input())
while t > 0:
	(n, m) = [int(x) for x in input().split()]
	e = m * (n - 1) + n * (m - 1)
	s = m * n
	if s >= e:
		print('YES')
	else:
		print('NO')
	t -= 1


def readInt():
	return int(input())

def readList():
	return list(map(int, input().rstrip().split()))

def readString():
	s = input()
	return s

def readInts():
	return map(int, input().rstrip().split())

def solve(n, m):
	if n == 2 and m == 2:
		return True
	if n == 1 or m == 1:
		return True
	return False
T = readInt()
for i in range(T):
	(n, m) = readInts()
	if solve(n, m):
		print('YES')
	else:
		print('NO')


T = int(input())
while T != 0:
	(n, m) = map(int, input().split())
	if n == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	elif m == 1:
		print('YES')
	else:
		print('NO')
	T -= 1


from sys import *
from math import *
from bisect import *
t = int(stdin.readline())
for _ in range(t):
	(n, k) = map(int, stdin.readline().split())
	if n == 1 or k == 1:
		print('YES')
	elif n == 2 and k == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for tt in range(t):
	nn = input()
	nn = nn.split()
	r = int(nn[0])
	c = int(nn[1])
	if r == 1 or c == 1:
		print('YES')
	elif r > 2 or c > 2:
		print('NO')
	else:
		print('YES')


exec(int(input()) * "n,m=map(int,input().split());print('YNEOS'[n+m<n*m::2]);")


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if n * k <= n + k:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
for test in range(int(stdin.readline())):
	arr = [int(x) for x in stdin.readline().split()]
	row = arr[0]
	column = arr[1]
	if row == 1 or column == 1:
		stdout.write('YES\n')
	elif row == 2 and column == 2:
		stdout.write('YES\n')
	else:
		stdout.write('NO\n')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def jigsaw():
	x = inp()
	for i in range(x):
		(n, m) = invr()
		if n == 1 or m == 1:
			print('YES')
		elif m == n == 2:
			print('YES')
		else:
			print('NO')
jigsaw()


tst = int(input())
for i in range(tst):
	lst = input()
	lst = lst.split()
	n = int(lst[0])
	m = int(lst[1])
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


for nt in range(int(input())):
	(n, m) = map(int, input().split())
	if n * m <= 4:
		print('YES')
		continue
	if n == 1 or m == 1:
		print('YES')
		continue
	print('NO')


from statistics import median
from fractions import gcd
from itertools import combinations
from collections import deque
from collections import defaultdict
import bisect
import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7

def readInts():
	return list(map(int, input().split()))

def main():
	t = int(input())
	for i in range(t):
		(n, m) = readInts()
		if n == 1 or m == 1:
			print('YES')
		elif n == 2 and m == 2:
			print('YES')
		else:
			print('NO')
main()


def solve():
	(n, m) = [int(v) for v in input().split()]
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	solve()


import sys
input = lambda : sys.stdin.readline().strip()
t = int(input())
while t:
	t -= 1
	(n, m) = map(int, input().split())
	if n == 1:
		print('YES')
	elif n <= 2 and m <= 2:
		print('YES')
	elif m == 1:
		print('YES')
	else:
		print('NO')


import math, sys
import heapq
from fractions import Fraction
from collections import Counter, defaultdict

def li():
	return list(map(int, sys.stdin.readline().split()))

def ls():
	return list(map(int, list(input())))

def la():
	return list(input())

def ii():
	return int(input())

def dic(x):
	return defaultdict(lambda : x)

def isPrime(n):
	i = 2
	if n == 1:
		return False
	while i <= int(math.sqrt(n)):
		if n % i == 0:
			return False
		i = i + 1
	return True

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def LCM(a, b):
	return a * b / gcd(a, b)
t = int(input())
for _ in range(t):
	(n, m) = li()
	if min([n, m]) == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


import io, os
R = lambda : map(int, input().split())
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print('YES' if n == 1 or m == 1 or (n == m and m == 2) else 'NO')


ii = 0
t = int(input())
while ii < t:
	(a, b) = [int(x) for x in input().split()]
	if a * b <= a + b:
		print('YES')
	else:
		print('NO')
	ii = ii + 1


t = int(input())
for T in range(t):
	n = input().split()
	m = int(n[0])
	n = int(n[1])
	if n == 1 or m == 1 or n * m == 4:
		print('YES')
	else:
		print('NO')


import sys
import math

def readStr():
	return sys.stdin.readline().rstrip()

def readInts():
	return list(map(int, readStr().split(' ')))

def main(n, m):
	if n == 1 or m == 1:
		return True
	if n == 2 and m == 2:
		return True
	return False
(t,) = readInts()
for _ in range(t):
	(n, m) = readInts()
	x = main(n, m)
	if x:
		print('YES')
	else:
		print('NO')


import sys
import heapq
import math
import bisect

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, input().split())

def rlinput():
	return list(map(int, input().split()))

def srlinput():
	return sorted(list(map(int, input().split())))
q = [2]
i = 2
while q[-1] < 1000000000.0:
	q.append(q[-1] + 2 * i + i - 1)
	i += 1

def main():
	(n, m) = rinput()
	if n == 2 and m == 2 or n == 1 or m == 1:
		print('YES')
	else:
		print('NO')
for sdfghjkl in range(iinput()):
	main()


from math import ceil, log, floor, sqrt
import math
k = 1

def mod_expo(n, p, m):
	result = 1
	while p != 0:
		if p % 2 == 1:
			result = result * n % m
		p //= 2
		n = n * n % m
	return result

def is_prime(n):
	m = 2
	while m * m <= n:
		if n % m == 0:
			return False
		m += 1
	return True

def find_sum(n, a):
	a.insert(0, 0)
	for i in range(1, n + 1):
		prev = a[i] & a[i - 1]
		cur = a[i] | a[i - 1]
		a[i - 1] = prev
		a[i] = cur
	return sum((m * m for m in a))

def prin_abc(x, y, z):
	l = [x, y, z]
	l.sort()
	if l[1] < l[2]:
		print('NO')
		return
	a = b = l[0]
	c = l[2]
	print('YES')
	print(a, b, c)

def get_scores(n, vals):
	l = 0
	r = n - 1
	turn = 0
	sereja = 0
	dima = 0
	while l <= r:
		if vals[l] > vals[r]:
			cur = vals[l]
			l += 1
		else:
			cur = vals[r]
			r -= 1
		if turn == 0:
			sereja += cur
		else:
			dima += cur
		turn = not turn
	print(sereja, dima)

def count_lamps(n, m):
	return (n * m + 1) // 2

def solvable(n, m):
	return min(m, n) == 1 or (m == 2 and n == 2)
t = 1
t = int(input())
while t:
	t = t - 1
	points = []
	(n, m) = map(int, input().split())
	if solvable(n, m):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(N, M) = [int(x) for x in input().split()]
		if N == 1 or M == 1:
			print('YES')
			continue
		if N == 2 and M == 2:
			print('YES')
			continue
		print('NO')
main()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if (m - 1) * (n - 1) <= 1:
		print('YES')
	else:
		print('NO')


import sys, bisect
from math import gcd
input = sys.stdin.readline

def inp():
	return int(input().rstrip())

def inlt():
	return list(map(int, input().rstrip().split()))

def insr():
	s = input().rstrip()
	return s[:len(s) - 1]

def invr():
	return map(int, input().rstrip().split())
times = 60
t = inp()
for _ in range(t):
	(n, m) = invr()
	if n <= 1 or m <= 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


import sys

class APuzzlePieces:

	def solve(self, tc=0):
		for _ in range(int(input())):
			(n, m) = [int(_) for _ in input().split()]
			if n == 1 or m == 1:
				print('YES')
				continue
			if n > 2 or m > 2:
				print('NO')
				continue
			print('YES')
solver = APuzzlePieces()
input = sys.stdin.readline
solver.solve()


import sys
T = int(sys.stdin.readline().strip())

def getT(line):
	return map(int, line.strip().split(' '))
for t in range(T):
	(m, n) = getT(sys.stdin.readline())
	if min(m, n) == 1:
		print('YES')
	elif min(m, n) == 2 and max(m, n) == 2:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def pat(n):
	return n * (3 * n + 1) // 2

def foo():
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
		return
	elif n == 2 and m == 2:
		print('YES')
		return
	print('NO')
t = inp()
for i in range(t):
	foo()


tc = int(input())
for zzz in range(tc):
	(x, y) = map(int, input().split())
	p = False
	if min(x, y) > 2:
		p = True
	elif min(x, y) == 2 and max(x, y) > 2:
		p = True
	if p:
		print('NO')
	else:
		print('YES')


a = int(input())
for i in range(0, a):
	(n, m) = input().split()
	if int(n) == 1 or int(m) == 1 or int(n) * int(m) == 4:
		print('YES')
	else:
		print('NO')


t = int(input())
for q in range(0, t):
	(n, k) = map(int, input().split())
	if n == k == 2:
		print('YES')
	elif n == 1 or k == 1:
		print('YES')
	else:
		print('NO')


def solve_case():
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		return 'YES'
	if n == 2 and m == 2:
		return 'YES'
	return 'NO'

def main():
	tests = int(input())
	for t in range(1, tests + 1):
		print('{}'.format(solve_case()))
main()


def puzzlePieces(m, n):
	if m == 1 or n == 1:
		return 'YES'
	if m == 2 and n == 2:
		return 'YES'
	return 'NO'
total = int(input().strip())
for _ in range(total):
	(m, n) = list(map(int, input().strip().split()))
	print(puzzlePieces(m, n))


z = input
from math import *
for _ in range(int(z())):
	(a, b) = map(int, z().split())
	if a == b <= 2 or a == 1 or b == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	d = list(map(int, input().split()))
	if min(d) == 1 or d == [2, 2]:
		print('YES')
		continue
	print('NO')


t = int(input())
for fk in range(t):
	(n, m) = [int(x) for x in input().split()]
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


import collections
import operator
for _ in range(int(input())):
	(n, k) = [int(t) for t in input().split(' ')]
	if n == 1 and k >= 1:
		print('YES')
	elif k == 1 and n >= 1:
		print('YES')
	elif k == 2 and n == 2:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
for testcases in range(int(stdin.readline())):
	(n, m) = map(int, stdin.readline().split())
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


def solution(a, b):
	if a == 1 or b == 1 or (a == 2 and b == 2):
		return 'YES'
	return 'NO'
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split(' '))
	print(solution(a, b))


t = int(input())
for u in range(t):
	temp = list(map(int, input().rstrip().split()))
	a = temp[0]
	b = temp[1]
	if a == 1:
		print('YES')
	elif b == 1:
		print('YES')
	elif a == 2 and b == 2:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(r, c) = map(int, input().split())
	if r > 2 and c >= 2 or (c > 2 and r >= 2):
		print('No')
	else:
		print('Yes')


t = int(input())
while t:
	(N, M) = map(int, input().split())
	if N == 1 or M == 1:
		print('YES')
	elif N > 2 or M > 2:
		print('NO')
	else:
		print('YES')
	t = t - 1


import math
from collections import Counter
from itertools import permutations, combinations
import fractions

def solve(a, b):
	if a == 1 or b == 1 or a * b <= 4:
		return 'YES'
	return 'NO'
t = int(input())
for _ in range(t):
	(a, b) = [int(s) for s in input().split(' ')]
	ans = solve(a, b)
	print(ans)


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
t = INT()
while t != 0:
	(n, m) = MAP()
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')
	t -= 1


def list_int():
	return list(map(int, input().split()))

def int_in():
	return int(input())

def map_in():
	return map(int, input().split())

def list_in():
	return input().split()
t = int_in()
for _ in range(t):
	(n, m) = map_in()
	if n == 1:
		print('YES')
	elif m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


def run():
	(N, M) = list(map(int, input().split()))
	if N < M:
		(N, M) = (M, N)
	if M == 1:
		print('YES')
		return
	elif M == N and N == 2:
		print('YES')
		return
	else:
		print('NO')
		return
T = int(input())
for i in range(T):
	run()


t = int(input())
for j in range(t):
	l = list(map(int, input().split()))
	n = l[0]
	m = l[1]
	if n == 1 or m == 1:
		print('YES')
	elif n <= 2 and m <= 2:
		print('YES')
	else:
		print('NO')


def jigsaw(m, n):
	if m == 1 or n == 1:
		print('YES')
	elif m == 2 and n == 2:
		print('YES')
	else:
		print('NO')
t = int(input())
for case in range(t):
	(m, n) = map(int, input().split())
	jigsaw(m, n)


for i in range(int(input())):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
		continue
	if n >= 3 or m >= 3:
		print('NO')
		continue
	print('YES')


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	if x == 1 or y == 1 or (x == 2 and y == 2):
		print('YES')
	else:
		print('NO')


def solve(x, y):
	return x == 1 or y == 1 or (x == 2 and y == 2)
cases = int(input())
for _ in range(cases):
	print('YES' if solve(*map(int, input().split())) else 'NO')


test = int(input())
for i in range(test):
	(l, L) = list(map(int, input().split(' ')))
	if L >= 2 and l > 2 or (l >= 2 and L > 2):
		print('NO')
	else:
		print('YES')


from math import gcd, ceil
from collections import defaultdict as dd

def lcm(a, b):
	return a * b // gcd(a, b)

def inin():
	return int(input())

def inar():
	return list(map(int, input().split()))

def ar(element, size):
	return [element for i in range(size)]

def digitsum(num):
	su = 0
	while num:
		su += num % 10
		num //= 10
	return su
for _ in range(int(input())):
	(n, m) = inar()
	if 2 * n * m - (m + n) > m * n:
		print('NO')
	else:
		print('YES')


def solve(n, m):
	if 1 in (n, m):
		return 'YES'
	if n == m == 2:
		return 'YES'
	return 'NO'

def main():
	T = int(input())
	for case in range(T):
		(n, m) = map(int, input().split())
		answer = solve(n, m)
		print(answer)
main()


from sys import stdin, stdout

def find(N, M):
	return 'YES' if N * (M - 1) + M * (N - 1) <= N + M else 'NO'

def main():
	for _ in range(int(stdin.readline())):
		(N, M) = list(map(int, stdin.readline().split()))
		print(find(N, M))
main()


from sys import stdin, stdout
q = int(input())
for i in range(q):
	(n, m) = list(map(int, stdin.readline().split()))
	if n == 1 or m == 1:
		print('YES')
	elif n * m <= 4:
		print('YES')
	else:
		print('NO')


N = int(input())
answers = []
for i in range(N):
	(x, y) = map(int, input().split())
	if x == 2 and y == 2:
		answers.append('YES')
	elif x >= 2 and y >= 2:
		answers.append('NO')
	else:
		answers.append('YES')
for i in answers:
	print(i)


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	a = min(n, k)
	b = max(n, k)
	if a == 1 or b == 2:
		print('YES')
	else:
		print('NO')


from sys import stdin
tc = int(stdin.readline())
for _ in range(tc):
	(n, m) = list(map(int, stdin.readline().split()))
	if n == 1 or m == 1:
		print('YES')
		continue
	if n == 2 and m == 2:
		print('YES')
		continue
	print('NO')


t = int(input())
for case in range(t):
	(a, b) = [int(s) for s in input().split(' ')]
	if min(a, b) == 1 or max(a, b) == 2:
		print('YES')
	else:
		print('NO')


inp = lambda cast=int: [cast(x) for x in input().split()]
printf = lambda s='', *args, **kwargs: print(str(s).format(*args), flush=True, **kwargs)
(t,) = inp()
for _ in range(t):
	(n, m) = inp()
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


sp = lambda : list(map(int, input().split()))
si = lambda : int(input())
TESTCASES = int(input())
for tc in range(TESTCASES):
	(n, m) = sp()
	print(('NO', 'YES')[n == 1 or m == 1 or (n == 2 and m == 2)])


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		(a, b) = list(map(int, input().split()))
		if a == 1 or b == 1:
			yield 'YES'
		elif a == 2 and b == 2:
			yield 'YES'
		else:
			yield 'NO'
t = int(input())
ans = gift()
print(*ans, sep='\n')


n = input()
y = float(n)
l = list()
i = 0
while i < y:
	line = input()
	word = line.split()
	n = int(word[0])
	m = int(word[1])
	x = (n - 1) * m + (m - 1) * n
	if n * m == 0:
		print('NO')
	elif x <= n * m:
		print('YES')
	else:
		print('NO')
	i = i + 1


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, M):
	if N == 2 and M == 2 or N == 1 or M == 1:
		return 'YES'
	return 'NO'
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N, M) = [int(x) for x in input().split()]
	ans = solve(N, M)
	print(ans)


from sys import stdin
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	(n, m) = [int(x) for x in inp().split()]
	minimum = min(n, m)
	maximum = max(n, m)
	if minimum == 1:
		print('YES')
	elif maximum > 2:
		print('NO')
	else:
		print('YES')


import collections as cc
import sys
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(n, m) = I()
	if n == 1 or m == 1:
		print('YES')
	elif n <= 2 and m <= 2:
		print('YES')
	else:
		print('NO')


from sys import stdin
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	if n is 1 or m is 1:
		print('YES')
	elif n is 2 and m is 2:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for c in range(t):
		(n, m) = [int(s) for s in input().split(' ')]
		print(solve(n, m))

def solve(n, m):
	if n < 3 and m < 3 or min(n, m) == 1:
		return 'YES'
	else:
		return 'NO'
main()


from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	(n, m) = mapi()
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	l = [int(i) for i in input().split(' ')]
	a = l[0]
	b = l[1]
	if a == 1 or b == 1:
		print('YES')
	elif a + b == 4:
		print('YES')
	else:
		print('NO')


def ans(n, m):
	if n == 1 or m == 1:
		return 'YES'
	if n > 2 or m > 2:
		return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	q = input().split()
	n = int(q[0])
	m = int(q[1])
	print(ans(n, m))


try:
	t = int(input())
	for i in range(t):
		(n, m) = map(int, input().split())
		if n == 1 or m == 1:
			print('YES')
		elif n == 2 and m == 2:
			print('YES')
		else:
			print('NO')
except EOFError:
	pass


t = int(input())
for asudjhakls in range(t):
	z = [int(x) for x in input().split()]
	n = z[0]
	m = z[1]
	if m == 1 or n == 1:
		print('YES')
	elif m == 2 and n == 2:
		print('YES')
	else:
		print('NO')


import math
import sys
import itertools
import itertools

def sa(Type=int):
	return [Type(x) for x in input().split()]

def solve(t):
	(n, m) = sa()
	if n > m:
		(n, m) = (m, n)
	if n == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(t):
	solve(i + 1)


def main():
	tc = int(input())
	for _ in range(tc):
		(n, m) = list(map(int, input().split()))
		can = False
		if n == 1 or m == 1:
			can = True
		if n == 2 and m == 2:
			can = True
		if can:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for i in range(t):
	NM = list(map(int, input().split()))
	n = NM[0]
	m = NM[1]
	if min(n, m) == 1:
		print('Yes')
	elif min(n, m) == 2:
		if n == m:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


def res(lis):
	if 1 in lis:
		return 'YES'
	if lis.count(2) == 2:
		return 'YES'
	return 'NO'
k = int(input())
for i in range(k):
	lis = list(map(int, input().split()))
	print(res(lis))


import math
import sys
from collections import defaultdict, Counter, deque, OrderedDict
import bisect
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]
from itertools import accumulate, groupby
for _ in range(int(input())):
	(n, m) = ilele()
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


def R():
	return map(int, input().split())

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
import bisect
for _ in range(I()):
	(n, m) = R()
	print(['NO', 'YES'][(n == 1 or m == 1) or (n == 2 and m == 2)])


def solve():
	t = int(input())
	for i in range(t):
		(n, m) = sorted([int(s) for s in input().split()])
		if n == 2 and m == 2:
			print('YES')
		elif n == 1 or m == 1:
			print('YES')
		else:
			print('NO')
solve()


for _ in range(int(input())):
	(n, m) = tuple(map(int, input().split()))
	a = (n - 1) * m + (m - 1) * n
	b = n * m
	if a <= b:
		print('YES')
	else:
		print('NO')


for i in [0] * int(input()):
	(a, b) = map(int, input().split())
	if a == 1 or b == 1:
		print('YES')
	elif a + b == 4:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	lista = [int(x) for x in input().split()]
	a = lista[0]
	b = lista[1]
	if a == 1 or b == 1:
		print('YES')
	elif a == 2 and b == 2:
		print('YES')
	else:
		print('NO')


import sys
import math

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]

def read_float_line():
	return [float(v) for v in sys.stdin.readline().split()]

def val(h):
	return 3 * (h * (h + 1) // 2) - h

def bi(n):
	l = 1
	r = n
	while l <= r:
		m = l + (r - l) // 2
		if val(m) == r:
			return val(m)
		elif val(m) > r:
			r = m - 1
		else:
			l = m + 1
	return -1
t = read_int()
for i in range(t):
	(n, m) = read_int_line()
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		(n, m) = map(int, input().split())
		if n == 1 or m == 1 or (n == 2 and m == 2):
			print('YES')
		else:
			print('NO')
	q = int(input())
	for _ in range(q):
		solve()
main()


import math
from collections import defaultdict, Counter

def main():
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
	elif n == m == 2:
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	main()


for (n, m) in [[int(x) for x in input().split()] for _ in range(int(input()))]:
	if True in [m == 2 and n == 2, min(m, n) == 1]:
		print('YES')
	else:
		print('NO')


import math
import sys
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	if m < n:
		(n, m) = (m, n)
	if n == 2 and m == 2 or n == 1:
		print('YES')
	else:
		print('NO')


import sys
input = iter(sys.stdin.read().splitlines()).__next__
sys.setrecursionlimit(10000)
TC = int(input())
for tc in range(TC):
	(N, M) = map(int, input().split())
	if N == 1 or M == 1 or (N == 2 and M == 2):
		res = 'YES'
	else:
		res = 'NO'
	print(res)


def solve():
	(x, y) = [int(x) for x in input().split(' ')]
	if x == 1 or y == 1:
		print('YES')
	elif x == 2 == y:
		print('YES')
	else:
		print('NO')
nums = int(input())
for _ in range(1, nums + 1):
	solve()


from math import *
from collections import *
from operator import itemgetter
import bisect
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
I = lambda : list(map(int, input().split()))
chrIdx = lambda x: ord(x) - 96
idxChr = lambda x: chr(96 + x)
t = ii()
for _ in range(t):
	(n, m) = iia()
	if min(n, m) == 1:
		print('YES')
	elif m == 2 and n == 2:
		print('YES')
	else:
		print('NO')


def isOkPuzzle(n, m):
	return min(n, m) == 1 or (n == 2 and m == 2)
t = int(input())
for _ in range(t):
	(n, m) = [int(x) for x in input().split()]
	if isOkPuzzle(n, m):
		print('YES')
	else:
		print('NO')


def main():
	for _ in range(int(input())):
		(n, m) = map(int, input().split())
		ans = (n - 1) * m + n * (m - 1)
		if ans <= m * n:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for z in range(t):
	(n, m) = map(int, input().rstrip().split())
	if n == 2 and m == 2:
		print('YES')
	elif n == 1 or m == 1:
		print('YES')
	else:
		print('NO')


from sys import stdin
import math

def inp():
	return stdin.readline().strip()
t = int(inp())
for _ in range(t):
	(n, m) = [int(x) for x in inp().split()]
	if min(n, m) == 1:
		print('YES')
	elif max(n, m) >= 3:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	k = list(map(int, input().split()))
	if k[0] < 3 and k[1] < 3:
		print('YES')
	elif k[0] < 2:
		print('YES')
	elif k[1] < 2:
		print('YES')
	else:
		print('NO')


def puz(n, m):
	if n == 1 or m == 1:
		print('yes')
		return
	elif n == 2 and m == 2:
		print('yes')
		return
	else:
		print('no')
	return
t = int(input())
for i in range(t):
	T = input()
	l = list(map(int, T.split()))
	puz(l[0], l[1])


n = int(input())
for i in range(n):
	x = list(map(int, input().rstrip().split()))
	if x[0] == 2 and x[1] == 2 or (x[0] == 1 or x[1] == 1):
		print('YES')
	else:
		print('NO')


t = int(input())
count = 0
while count < t:
	count += 1
	l = list(map(int, input().split(' ')))
	if l[0] == 1 or l[1] == 1:
		print('YES')
	elif l[0] == 2 and l[1] == 2:
		print('YES')
	else:
		print('NO')


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scan_int = lambda : int(input())
scan_string = lambda : input().rstrip()
read_list = lambda : list(read())
read = lambda : map(int, input().split())
read_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(beauty, s, n, count):
	pass
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect

def solve():
	(n, m) = read()
	if n == 1:
		print('YES')
		return
	elif m == 1:
		print('YES')
		return
	elif n == 2 and m == 2:
		print('YES')
		return
	else:
		print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for i in range(scan_int()):
	solve()


def io():
	return map(int, input().split())

def op():
	return list(map(int, input().split()))
for i in range(int(input())):
	(a, b) = io()
	if a == 1 or b == 1 or (a == 2 and b == 2):
		print('Yes')
	else:
		print('No')


from sys import stdin
input = stdin.readline
R = lambda : map(int, input().split())
for _ in range(int(input())):
	(r, c) = R()
	if r == 1 or c == 1 or r == c == 2:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	q = list(input().split(' '))
	if int(q[0]) == 1 or int(q[1]) == 1:
		print('Yes')
	elif int(q[0]) == int(q[1]) == 2:
		print('Yes')
	else:
		print('No')


tests = int(input())
while tests > 0:
	(n, m) = [int(i) for i in input().split(' ')]
	if n == 1 or m == 1 or (n == 2 and m == 2):
		print('YES')
	else:
		print('NO')
	tests = tests - 1


def main():
	test_cases = int(input())
	for _ in range(test_cases):
		(n, m) = [int(num) for num in input().split()]
		if n == 1 or m == 1:
			print('YES')
		elif n == 2 and m == 2:
			print('YES')
		else:
			print('NO')
main()


import sys
input = sys.stdin.readline
t = int(input())
for r in range(t):
	(n, m) = map(int, input().split())
	if n == 1:
		print('YES')
	elif m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


import sys
try:
	sys.stdin = open(sys.path[0] + '\\input.txt', 'r')
	sys.stdout = open(sys.path[0] + '\\output.txt', 'w')
except FileNotFoundError:
	pass
for tc in range(int(input())):
	(n, m) = list(map(int, input().split()))
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


p = int(input())
for z in range(p):
	(n, m) = [int(i) for i in input().split()]
	if n == 2 and m == 2:
		print('YES')
	elif n >= 2 and m >= 2:
		print('NO')
	else:
		print('YES')


def solution():
	(a, b) = list(map(int, input().split()))
	res = 'NO'
	if a == 1 or b == 1 or (a == 2 and b == 2):
		res = 'YES'
	print(res)
T = int(input())
for t in range(T):
	solution()


T = int(input())
for _ in range(T):
	(N, M) = map(int, input().split())
	if N == 1:
		print('YES')
	elif N == 2:
		if M <= 2:
			print('YES')
		else:
			print('NO')
	elif M == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
result = dict()
for i in range(t):
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	edges = (m - 1) * n + (n - 1) * m
	gap = m * n
	if n == 1 and m == 1:
		result[i] = 'YES'
	elif n == 2 and m == 2:
		result[i] = 'YES'
	elif edges <= gap:
		result[i] = 'YES'
	else:
		result[i] = 'NO'
for i in range(t):
	print(result[i])


test = int(input())
for _ in range(test):
	(n, m) = map(int, input().split())
	con = n * (m - 1) + m * (n - 1)
	if n == 1 or m == 1:
		print('YES')
	elif n * m != con:
		print('NO')
	else:
		print('YES')


t = int(input())
lis = []
out = []
for i in range(t):
	lis.append([int(j) for j in input().split()])
	(m, n) = (lis[i][0], lis[i][1])
	if m == 1 or n == 1 or m == n == 2:
		out.append('YES')
	else:
		out.append('NO')
for i in out:
	print(i)


def dtb(n):
	return bin(n).replace('0b', '')

def btd(n):
	return int(n, 2)
t = int(input())
for k in range(t):
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
		continue
	if n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b) = map(int, input().split())
	print('YES' if a == 1 or b == 1 or a + b <= 4 else 'No')


import math

def r():
	return map(int, input().split())

def l():
	return list(map(int, input().split()))

def i():
	return int(input())

def si():
	return input()

def pYes():
	print('YES')

def pNo():
	print('NO')

def plist(l):
	print(''.join(l))
t = i()
ls = []
dic = {}
for i in range(t):
	(a, b) = r()
	if a == 1 or b == 1:
		pYes()
	elif max(a, b) > 2:
		pNo()
	else:
		pYes()


t = int(input())
for i in range(t):
	(n, m) = [int(x) for x in input().split()]
	if n == 1 or m == 1 or m * n == 4:
		print('YES')
	else:
		print('NO')


def read():
	t = int(input())
	for i in range(t):
		(n, m) = list(map(int, input().strip().split()))
		if n == 2 and m == 2:
			print('YES')
		elif min(n, m) >= 2:
			print('NO')
		else:
			print('YES')
read()


def solve():
	(n, m) = map(int, input().split(' '))
	if n == 1 or m == 1 or n * m == 2 or (n * m == 4):
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	solve()


def solve(n, m):
	if n == 2 and m == 2:
		return 'YES'
	if n > 1:
		if m == 1:
			return 'YES'
		else:
			return 'NO'
	else:
		return 'YES'

def main():
	tests = int(input())
	while tests:
		line = input().split()
		n = int(line[0])
		m = int(line[1])
		print(solve(n, m))
		tests -= 1
main()


n = int(input())
for i in range(0, n):
	[a, b] = map(int, input().split())
	d = min(a, b)
	if d == 1:
		print('YES')
	elif a == 2 and b == 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b) = input().split()
	if int(a) == 1 or int(b) == 1:
		print('yes')
	elif int(a) == int(b) == 2:
		print('yes')
	else:
		print('no')


from collections import *
from bisect import *
from math import *
import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	(n, m) = map(int, input().split())
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 1 or n == m == 2 or (n == 1 and m == 2):
		print('YES')
	else:
		print('NO')


t = int(input())
for k in range(t):
	line = input().split()
	n = int(line[0])
	m = int(line[1])
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


def read_int():
	return int(input().strip())

def read_ints():
	return list(map(int, input().strip().split(' ')))

def solve():
	(n, m) = read_ints()
	if n == 1 or m == 1:
		return 'YES'
	if n == 2 and m == 2:
		return 'YES'
	return 'NO'
T = read_int()
for _ in range(T):
	print(solve())


case = int(input())
for caseNum in range(0, case):
	(a, b) = [int(x) for x in input().split()]
	if a == 1 or b == 1 or (a == 2 and b == 2):
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	(x, y) = list(map(int, input().split()))
	if x == 1 or y == 1 or x * y == 4:
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	(n, m) = list(map(int, input().split()))
	if n == 1 or m == 1:
		print('YES')
		continue
	if n < 3 and m < 3:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, m) = [int(s) for s in input().split(' ')]
	piece = int(n * m)
	edge = int((n - 1) * m + (m - 1) * n)
	if piece < edge:
		print('NO')
	else:
		print('YES')


t = int(input())
while t:
	li = [int(i) for i in input().split()]
	r = li[0]
	c = li[1]
	e = r * (c - 1) + c * (r - 1)
	if e <= r * c:
		print('YES')
	else:
		print('NO')
	t -= 1


def cal(arr):
	a = arr[0]
	b = arr[1]
	if a == 1 or b == 1:
		return 'YES'
	if a == 2 and b == 2:
		return 'YES'
	return 'NO'

def web():
	T = int(input())
	for t in range(1, T + 1):
		arr = [int(s) for s in input().split(' ')]
		ans = cal(arr)
		print(str(ans))

def file():
	x = open('p1_in.txt')
	T = int(x.readline())
	for t in range(1, T + 1):
		arr = [int(s) for s in x.readline().split(' ')]
		ans = cal(arr)
		print(str(ans))
web()


t = int(input())
while t > 0:
	(n, m) = [int(i) for i in input().split()]
	if n == 1 or m == 1 or n + m == 4:
		print('YES')
	else:
		print('NO')
	t = t - 1


a = int(input())
for _ in range(a):
	(x, y) = map(int, input().split())
	if x * y <= x + y:
		print('YES')
	else:
		print('NO')


import sys
import os
from io import BytesIO, IOBase

def cel(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return defaultdict(int)

def ddl():
	return defaultdict(list)

def ddd():
	return defaultdict(defaultdict(int))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict
for _ in range(ii()):
	(n, m) = mi()
	if n == 1 or m == 1 or (m == 2 and n == 2):
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007

def main():
	for t in range(I()):
		(n, m) = In()
		if n == 2 and m == 2:
			print('YES')
		elif n == 1 or m == 1:
			print('YES')
		else:
			print('NO')
main()


a = int(input())
for i in range(a):
	(b, c) = map(int, input().split())
	if b * c <= b + c:
		print('yes')
	else:
		print('no')


test = int(input())
for i in range(test):
	(x, y) = input(' ').split()
	x = int(x)
	y = int(y)
	if x == 1 or y == 1:
		print('YES')
	elif x == 2 and y == 2:
		print('YES')
	else:
		print('NO')


test = int(input())
for tes in range(test):
	(r, c) = list(map(int, input().split()))
	if r + c <= 4:
		print('YES')
	elif r == 1 or c == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	str = input()
	lis = str.split(' ')
	if lis[0] == '1' or lis[1] == '1':
		print('YES')
	elif lis[0] == '2' and lis[1] == '2':
		print('YES')
	else:
		print('NO')


t = int(input())
l = []
for i in range(t):
	s = input()
	(n, m) = map(int, s.split(' '))
	holes = n * m
	edges = n * (m - 1) + m * (n - 1)
	if holes >= edges:
		l.append('YES')
	else:
		l.append('NO')
for i in l:
	print(i)


import sys
sys.setrecursionlimit(10 ** 6)

def f(n, m):
	if 1 == n or 1 == m:
		return True
	if 2 == n and 2 == m:
		return True
	return False
nofkase = int(input())
for kase in range(nofkase):
	(n, m) = [int(i) for i in input().split()]
	print('YES' if f(n, m) else 'NO')


import sys
from os import path
if path.exists('C:/Users/prana/Desktop/sublime/input.txt'):
	sys.stdin = open('C:/Users/prana/Desktop/sublime/input.txt', 'r')
	sys.stdout = open('C:/Users/prana/Desktop/sublime/output.txt', 'w')

def solve():
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	if (n - 1) * m + (m - 1) * n <= n + m:
		print('YES')
	else:
		print('NO')
T = 1
T = int(input())
for _ in range(1, T + 1):
	print('Case #', _, file=sys.stderr)
	solve()


import sys
input = lambda : sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
	(n, m) = map(int, ipnut().split())
	if n == m == 2 or min(n, m) == 1:
		print('YES')
	else:
		print('NO')


import sys
from sys import stdin, stdout
import math

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def code(n, m):
	if n == 1 or m == 1:
		return 'YES'
	elif n == 2 and m == 2:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for i in range(t):
	(n, m) = get_ints()
	ans = code(n, m)
	print(ans)


def funct(x, y):
	if x == 1 or y == 1:
		return 0
	elif x == 2 and y == 2:
		return 0
	else:
		return 1
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	bibs = funct(n, m)
	if bibs == 0:
		print('Yes')
	else:
		print('No')


def algo(m, n):
	if m == 1 or n == 1:
		return 'YES'
	if m == 2 and n == 2:
		return 'YES'
	return 'NO'
c = int(input())
for _ in range(c):
	(m, n) = map(int, input().split())
	print(algo(m, n))


from sys import stdin

def get_ints():
	return list(map(int, stdin.readline().strip().split()))
for _ in range(int(input())):
	(n, m) = get_ints()
	if min(n, m) == 1:
		print('YES')
	elif min(n, m) == 2 and max(n, m) == 2:
		print('YES')
	else:
		print('NO')


answer = []
for i in range(int(input())):
	(n, m) = list(map(int, input().split()))
	if n * m <= n + m:
		answer.append('YES')
	else:
		answer.append('NO')
for i in range(len(answer)):
	if answer[i] == -1:
		print(-1)
	else:
		print(answer[i])


def task(n, m):
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(0, t):
	(n, m) = map(int, input().split())
	task(n, m)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
from collections import deque
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
t = ip()
for _ in range(t):
	(n, m) = inp()
	if n == 1 or m == 1:
		print('YES')
	elif n == 2 and m == 2:
		print('YES')
	else:
		print('NO')


MOD = 10 ** 9 + 7
INT_MAX = 10 ** 20 + 7

def INPUT():
	return list((int(i) for i in input().split()))

def LIST_1D_ARRAY(n):
	return [0 for _ in range(n)]

def LIST_2D_ARRAY(m, n):
	return [[0 for _ in range(n)] for _ in range(m)]

def power(a, x):
	res = 1
	while x > 0:
		if x & 1:
			res = res * a % MOD
		a = a * a % MOD
		x //= 2
	return res % MOD

def NCR_MOD(n, r):
	num = 1
	for i in range(n, n - r, -1):
		num = num * i % MOD
	for j in range(1, r + 1):
		num = num * power(j, MOD - 2) % MOD
	return num
import math as M

def F(n):
	for i in range(2, n + 1):
		if n % i == 0:
			return i

def calc(n, k):
	if a == 1 or b == 1:
		return 'YES'
	if a == 2 and b == 2:
		return 'YES'
	return 'NO'
for _ in range(int(input())):
	(a, b) = INPUT()
	print(calc(a, b))


t = int(input())
for t in range(t):
	(n, m) = [int(i) for i in input().split(' ')]
	tabs = 3 * n * m
	blank = n * m
	dif = abs(tabs - blank)
	if dif % 2 == 0 and dif <= 2 * n + 2 * m:
		print('YES')
	else:
		print('NO')


t = int(input())
m_ = []
n_ = []
for i in range(t):
	(m, n) = map(int, input().split())
	m_.append(m)
	n_.append(n)

def buzz(m, n):
	t = 2 * m * n - (m + n)
	k = m * n
	if k >= t:
		return 1
	else:
		return 0
for i in range(t):
	h = buzz(m_[i], n_[i])
	if h:
		print('YES')
	else:
		print('NO')


import math
import sys
import re
for x in range(int(input())):
	(n, m) = map(int, input().rstrip().split())
	if n * m >= n * (m - 1) + m * (n - 1):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	l = [int(i) for i in input().split()]
	r = l[0]
	c = l[1]
	if r == 1 or c == 1:
		print('YES')
	elif r >= 3 or c >= 3:
		print('NO')
	else:
		print('YES')


def puzzlePieces(arr):
	(r, c) = (arr[0], arr[1])
	if r == 1 or c == 1:
		return 'YES'
	elif r == 2 and c == 2:
		return 'YES'
	return 'NO'
tc = int(input())
for i in range(tc):
	n = list(map(int, input().split()))
	print(puzzlePieces(n))


t = int(input())
for items in range(t):
	(x, y) = map(int, input().split())
	if x > y:
		(x, y) = (y, x)
	if x == 1 or (x == 2 and y == 2):
		print('YES')
	else:
		print('NO')