Yuki has a table with $n$ rows and $m$ columns.
She wants to fill each cell with a non-negative integer no greater than $n \cdot m$ such that the sum of the $\operatorname{mex}^\ast$ of each row and the $\operatorname{mex}$ of each column is maximized.
Formally, let $a_{i,j}$ denote the number in the $i$-th row and $j$-th column of the table. She wants to maximize:
$$ \sum\limits_{i = 1}^{n} \operatorname{mex}\{a_{i,1}, \ldots, a_{i,m}\} + \sum\limits_{j = 1}^{m} \operatorname{mex}\{a_{1,j}, \ldots, a_{n,j}\} $$
Unfortunately, Yuki does not know how to construct this table. Can you help her?
$^\ast$: The $\operatorname{mex}$ of a sequence is the smallest non-negative integer that does not appear in the sequence. For example, $\operatorname{mex}\{0,1,2\}=3$, $\operatorname{mex}\{1,0,3,1\}=2$, and $\operatorname{mex} \varnothing=0$.
Input
This problem contains multiple test cases.
The first line contains a positive integer $t\ (1 \le t \le 10^5)$, representing the number of test cases.
For each test case:
- One line containing two positive integers $n, m\ (1 \le n \cdot m \le 5\cdot10^5)$.
It is guaranteed that the sum of $n \cdot m$ over all test cases does not exceed $5\cdot10^5$.
Output
For each test case, output $n$ lines, each containing $m$ non-negative integers no greater than $n \cdot m$, representing the numbers in your constructed table.
Examples
Input 1
3 2 4 1 1 3 4
Output 1
1 2 0 3 0 3 1 2 0 1 2 0 1 0 1 2 0 2 0 1 3
Note
For the first test case:
- The $\operatorname{mex}$ of the first and second rows of the given table is $4$, the $\operatorname{mex}$ of the first and third columns is $2$, and the $\operatorname{mex}$ of the second and fourth columns is $0$. The sum of the $\operatorname{mex}$ of each row and each column is $12$.
- It can be proven that $12$ is the maximum possible sum of the $\operatorname{mex}$ of each row and each column among all possible constructions.
For the second test case:
- Clearly, $a_{1,1}=0$ maximizes the sum of the $\operatorname{mex}$ of each row and each column.
For the third test case:
- It can be proven that $21$ is the maximum possible sum of the $\operatorname{mex}$ of each row and each column among all possible constructions.