- Time limit: 1.00 s
- Memory limit: 512 MB
Create an grid that fulfills the following requirements:
- Each integer appears times in the grid.
- If we create a set that consists of all sums in rows and columns, there are distinct values.
Input
The only line has an integer .
Output
Print a grid that fulfills the requirements. You can print any valid solution. If there are no solutions, print IMPOSSIBLE
.
Constraints
Example
Input:
5
Output:
2 3 1 1 1 1 5 5 3 3 2 3 5 2 4 5 4 5 4 1 2 3 4 4 2
Explanation: Each integer appears times, and the sums in rows and columns are .