题目描述
Problem Description
tada72 found a strange paper. The paper said, "This paper contains $1$ twice, $2$ three times, $3$ twice, and $4$ once." Inspired by this, he wanted to create more papers with similar properties.
Given an integer $N$, determine if there exists a sequence $A$ of length $N$ that satisfies the following two conditions. If it exists, construct it.
- All elements of the sequence are integers between $1$ and $N$ inclusive.
- For all integers $i$ satisfying $1 \leq i \leq N$, there are exactly $A_i - 1$ integers $j$ such that $i = A_j$ (where $1 \leq j \leq N$).
Input Format
The input is given from the standard input in the following format:
$ N $
Output Format
If no sequence $A$ satisfies the conditions, output -1 in one line. If it exists, output the sequence $A$ in the following format:
$ A_1 $ $ A_2 $ $\ldots$ $ A_N $
Note that if multiple sequences $A$ satisfy the conditions, you may output any one of them.
Sample Input and Output
Sample Input #1
4
Sample Output #1
2 3 2 1
Sample Input #2
2
Sample Output #2
-1
Notes/Hints
Constraints
- $1 \leq N \leq 10^5$
- All inputs are integers.
Sample Explanation 1
$A$ contains $1$ once, $2$ twice, $3$ once, and $4$ zero times, satisfying the conditions.
Sample Explanation 2
Original idea: tada72
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分