A **permutation** is a sequence of integers which contains each
integer from ** 1** to

**Antimonotonic:**for each consecutive 3 values,*p*_{i-1},*p*_{i}(*p*_{i+1}),*1 < i < n*should either be the smallest or the biggest of the three values.*p*_{i}**Cyclic:**The permutation should consist of only one cycle, that is, when we useas a pointer from*p*_{i}to*i*, it should be possible to start at position*p*_{i}and follow the pointers and reach all*1*positions before returning to position*n*.*1*

The input file contains several test cases. Each test case consists of a line containing an integer n, (3 ≤ n ≤ 10^6), the number of integers in the permutation. Input is terminated by n=0.

提交代码