cho.sh
Notes
Loading...

Circle Dance

Time limit

2s

Memory limit

128 MB

Problem

Students are preparing a circular hand-holding dance for the first full moon of the lunar year.

An odd number of students participate. Let the number of students be 2K+1. In one dance, all students stand in a circle while holding hands, so each student holds hands with the two students immediately to their left and right.

Each dance gives every student two hand-holding partners. After exactly K dances, each student has 2K partner opportunities. Since every student has exactly 2K other students, we want to choose K circular orders so that every pair of distinct students holds hands exactly once.

For example, with 5 students numbered 1 through 5, one valid choice is to use the circular orders 1 5 4 2 3 and 1 2 5 3 4. Then every student holds hands with each of the other four students exactly once.

Given the number of students 2K+1, output circular orders for the K dances that satisfy this condition.

Input

The first line contains the number of students, 2K+1. It is an odd integer between 3 and 2,399, inclusive.

Output

Output K lines. Each line must contain a circular order for one dance, written as 2K+1 integers. Every line must contain each student number from 1 through 2K+1 exactly once.

If there are multiple valid answers, output any one of them. If no valid answer exists, output only -1 on the first line.