Codeforces Round 639 (Div. 2)
A
Puzzle Pieces
Codeforces
800
原题
←B →
翻译中…

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.

翻译中…

image

翻译中…

The jigsaw puzzle is considered solved if the following conditions hold:

翻译中…
  1. The pieces are arranged into a grid with $n$ rows and $m$ columns.
  2. 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).

翻译中…

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:

翻译中…

image

翻译中…

样例

Input #1
3
1 3
100000 100000
2 2
Output #1
YES
NO
YES
InputCopy OutputCopy
题目信息
题号
1345A
时间限制
1 s
内存限制
256 MB
标签
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。