#P12676. 相等排列(equal)
相等排列(equal)
Background
This problem was planned to redesign part of the scoring in early July.
Due to personal reasons, it is planned to be postponed.
Problem Description
This problem has test cases.
You need to construct permutations of length such that, for each of the numbers, the sum of the indices (indices start from ) of this number across the permutations are all equal. If there is no solution, output .
Input Format
The first line contains a positive integer .
For each test case:
Input one line with two positive integers .
Output Format
For each test case:
Output lines, each containing positive integers, or output a single line with an integer to indicate your answer.
3
3 3
2 5
1 3
1 2 3
2 3 1
3 1 2
5 1 4 2 3
3 2 4 1 5
-1
Hint
For of the testdata, it is guaranteed that , , .
Translated by ChatGPT 5