atcoder#RELAYI. 目があったら負け

目があったら負け

Score : 100100 points

Problem Statement

There are NN persons, conveniently numbered 11 through NN. They will take 3y3s Challenge for N1N-1 seconds.

During the challenge, each person must look at each of the N1N-1 other persons for 11 seconds, in some order.

If any two persons look at each other during the challenge, the challenge ends in failure.

Find the order in which each person looks at each of the N1N-1 other persons, to be successful in the challenge.

Constraints

  • 2N1002 \leq N \leq 100

Input

The input is given from Standard Input in the following format:

NN

Output

If there exists no way to be successful in the challenge, print -1.

If there exists a way to be successful in the challenge, print any such way in the following format:

A1,1A_{1,1} A1,2A_{1,2} ...... A1,N1A_{1, N-1}

A2,1A_{2,1} A2,2A_{2,2} ...... A2,N1A_{2, N-1}

:

AN,1A_{N,1} AN,2A_{N,2} ...... AN,N1A_{N, N-1}

where Ai,jA_{i, j} is the index of the person that the person numbered ii looks at during the jj-th second.

Judging

The output is considered correct only if all of the following conditions are satisfied:

  • 1Ai,jN1 \leq A_{i,j} \leq N
  • For each ii, Ai,1,Ai,2,...,Ai,N1A_{i,1}, A_{i,2}, ... , A_{i, N-1} are pairwise distinct.
  • Let X=Ai,jX = A_{i, j}, then AX,jiA_{X, j} \neq i always holds.
7
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
2
-1