B. Magical Palette
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

The little white rabbit has a magical palette with a grid of $$$n$$$ rows and $$$m$$$ columns. Before starting to mix the colors, the little white rabbit will squeeze a kind of pigment to the left of each row, denoted by $$$a_1, a_2, \ldots, a_n$$$, and also squeeze a kind of pigment above each column, denoted by $$$b_1, b_2, \ldots, b_m$$$.

There are a total of $$$n \times m$$$ kinds of selectable pigments, represented by integers $$$0, 1, 2, \ldots, nm-1$$$ for different pigments. Then, in the cell of the $$$i$$$-th row and the $$$j$$$-th column, the little white rabbit will mix a color $$$c_{i,j} = a_ib_j \bmod nm$$$ using the pigment $$$a_i$$$ to the left of the $$$i$$$-th row and the pigment $$$b_j$$$ above the $$$j$$$-th column.

The little white rabbit hopes that each of the $$$n \times m$$$ cells has a different color, and you need to find out whether it can be achieved.

Input

The first line of the input contains an integer $$$T$$$ ($$$1 \le T \le 10^4$$$), indicating the number of test cases. For each test case:

The only line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 10^6$$$, $$$1 \le n \times m \le 10^6$$$), indicating the number of rows and the number of columns.

It is guaranteed that the sum of $$$n \times m$$$ over all test cases does not exceed $$$10^6$$$.

Output

For each test case, if no solution exists, output "No" (without quotes) in one line. Otherwise, output three lines:

  • The first line contains one string "Yes" (without quotes).
  • The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \lt nm$$$).
  • The third line contains $$$m$$$ integers $$$b_1, b_2, \ldots, b_m$$$ ($$$0 \le b_i \lt nm$$$).
Example
Input
2
2 3
2 2
Output
Yes
1 2
1 3 5
No
Note

For the first sample case, $$$[c_{1,1}, c_{1,2}, c_{1,3}, c_{2,1}, c_{2,2}, c_{2,3}] = [1, 3, 5, 2, 0, 4]$$$, which are pairwise different.