时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld
题目描述
Roundgod draws a grid graph of size

with

cells. She can use one of

colors to color every edge once, but lzr gives her some limits.
- lzr loves balance. All colors should appear in the same number of times.
- lzr loves complexity. The graph should not contain any monochromatic cycle.
- lzr hates monotone. Each whole horizontal or vertical line of the graph should contain at least two colors.
Roundgod is so divine that she doesn't want to waste her god's power to solve this problem. Could you give her a solution?
输入描述:
The input contains multiple test cases. The first line of input contains one integer
)
.
In the following

lines, each line contains two integers
n))
describing one test case.
输出描述:
For each test case, if there's no solution, please output "-1".
Otherwise, output
)
lines.
For the first

lines, each line contains

integers, denoting colors of edges on every horizontal line.
For the last

lines, each line contain

integers, denoting colors of edges on every vertical line.
示例1
输出
复制
1 2
3 1
3 2
1 3
2 1
2 3
-1