#GYM104768L. Alea Iacta Est

Alea Iacta Est

本题没有可用的提交语言。

Description

SSerxhs has two dice with $n$ and $m$ sides respectively, and the numbers on their faces are $1, 2, 3, \ldots, n$ and $1, 2, 3,\ldots, m$. He is interested in the probability distribution of the sum of numbers rolled on both dice. Help him find another pair of dice, different from the original one, such that their sum follows this distribution.

Since it is difficult to create dice with a large number of faces, you should minimize the sum of the number of faces on the dice.

It is assumed that the probability of each face being rolled on any die is equal.

Two pairs of dice are considered different if and only if one die from one pair is different from any die in the other pair.

Two dice are considered different if and only if there exists a number $x$ such that the number of occurrences of $x$ on the faces of the two dice is different.

Two random variables $X$ and $Y$ follow the same probability distribution if and only if $\forall k, P(X=k) = P(Y=k)$.

Each test contains multiple test cases. The first line contains a single interger $t$ ($1 \leq t \leq 4000$), denoting 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$), denoting the number of faces of the two dice.

It is guaranteed that the sum of $\max\{n,m\}$ over all testcases does not exceed $10^6$.

For each test case, print two lines containing several integers describing the two dice.

For the $i$-th line, the first integer $f_i$ denotes the number of face of the $i$-th die. The remaining $f_i$ integers on the line $a_1,a_2,\ldots,a_{f_i}$ ($1\le a_j< n+m$) denotes the numbers on each face of the corresponding die. It is possible for the numbers on the faces to be repeated.

If there are multiple solutions, you can print any of them.

Especially, if there is no solution, print "$0$" on both lines instead.

It is guaranteed that the sum of $f_i$ over all test cases does not exceed $3\cdot 10^6$.

Additional blank lines have been added in the sample to separate different test cases. You are free to choose whether to print these blank lines in your output.

Input

Each test contains multiple test cases. The first line contains a single interger $t$ ($1 \leq t \leq 4000$), denoting 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$), denoting the number of faces of the two dice.

It is guaranteed that the sum of $\max\{n,m\}$ over all testcases does not exceed $10^6$.

Output

For each test case, print two lines containing several integers describing the two dice.

For the $i$-th line, the first integer $f_i$ denotes the number of face of the $i$-th die. The remaining $f_i$ integers on the line $a_1,a_2,\ldots,a_{f_i}$ ($1\le a_j< n+m$) denotes the numbers on each face of the corresponding die. It is possible for the numbers on the faces to be repeated.

If there are multiple solutions, you can print any of them.

Especially, if there is no solution, print "$0$" on both lines instead.

It is guaranteed that the sum of $f_i$ over all test cases does not exceed $3\cdot 10^6$.

Additional blank lines have been added in the sample to separate different test cases. You are free to choose whether to print these blank lines in your output.

3
2 8
1 9
2 9
4 1 2 3 4
4 1 2 5 6

3 1 2 3
3 1 4 7

6 1 2 4 5 7 8
3 1 2 3