Statement
In Mog's old neighborhood, buildings are arranged in a grid. Let be the height of the building in row , column .
All heights are distinct, and each integer from through appears exactly once.
Viewed from the front, column appears to have height . Let the sum of these values be . Viewed from the side, row appears to have height . Let the sum of these values be .
Given an integer , construct any arrangement satisfying . If no such arrangement exists, report that it is impossible.
Input
The input is given from Standard Input in the following format:
Each case is given in the following format:
Output
For each test case, if no valid arrangement exists, print -1 on one line.
Otherwise, print the matrix in lines. The -th line must contain separated by spaces.
If multiple arrangements are possible, print any of them.
Constraints
- .
- .
- .
- The sum of over all test cases does not exceed .
Subtasks
Samples
The visible heights of the columns are and , while the visible heights of the rows are and . Therefore,
so .