题目描述
Problem Description
There are $ N $ people numbered from $ 1 $ to $ N $. They will participate in a "Staring Contest" for $ N-1 $ seconds.
Each person will stare at each of the other $ N-1 $ people for exactly $ 1 $ second each, in some order.
If two people stare at each other at the same time, the challenge fails.
Determine the order in which each person should stare at the other $ N-1 $ people to ensure the challenge succeeds.
Input Format
The input is given from the standard input in the following format:
$ N $
Output Format
If there is no way for the challenge to succeed, output $ -1 $.
If there is a way for the challenge to succeed, output one such way in the following format:
$ A_{1,1} $ $ A_{1,2} $ $ ... $ $A_{1,\ N-1}$ $ A_{2,1} $ $ A_{2,2} $ $ ... $ $A_{2,\ N-1}$ $ : $ $ A_{N,1} $ $ A_{N,2} $ $ ... $ $A_{N,\ N-1}$
Here, $A_{i,\ j}$ is the number of the person that the $ i $th person stares at in the $ j $th second.
Sample Input and Output
Sample Input #1
7
Sample Output #1
2 3 4 5 6 7
5 3 1 6 4 7
2 7 4 1 5 6
2 1 7 5 3 6
1 4 3 7 6 2
2 5 7 3 4 1
2 6 1 4 5 3
Sample Input #2
2
Sample Output #2
-1
Notes/Hints
Constraints
- $2\ \leq\ N\ \leq\ 100$
Judging
The output is considered correct only if all the following conditions are met:
- $1\ \leq\ A_{i,j}\ \leq\ N$
- For all $ i $, $A_{i,1},\ A_{i,2},\ ...\ ,\ A_{i,\ N-1}$ are distinct values.
- Let $X\ =\ A_{i,\ j}$, then $A_{X,\ j}\ \neq\ i$ always holds.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分