You are given two integers $$$n$$$ and $$$x$$$ ($$$0 \le x \le n-1$$$).
Construct a matrix $$$A$$$ of size $$$n\times n$$$ satisfying all of the following conditions:
Here, $$$\oplus$$$ denotes the bitwise XOR operation.
Or determine that no such matrix exists.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 180$$$). The description of the test cases follows.
The only line of each test case contains two integers $$$n$$$ and $$$x$$$ ($$$2\le n\le 2500$$$, $$$0\le x \lt n$$$).
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2500$$$.
For each test case, output $$$-1$$$ if no such matrix exists. Otherwise, output any valid $$$n$$$ lines of the matrix.
If several valid matrices exist, you may output any of them.
52 02 13 04 14 0
0 11 0-1-10 2 1 32 1 3 01 3 0 23 0 2 10 1 2 31 0 3 22 3 0 13 2 1 0
In the first test case, the displayed matrix has both rows and columns equal to permutations of $$$0,1$$$, and its only adjacent $$$2\times2$$$ submatrix has XOR $$$0$$$.
The second and third test cases are impossible. In the last two test cases, every adjacent $$$2\times2$$$ submatrix has XOR, respectively, $$$1$$$ and $$$0$$$.