Given an integer
- For all
, is prime. - The number of distinct
as is the minimum possible among all permutations satisfying the first condition.
Note that there is no absolute value in the second condition.
To ensure the integrity of your solution, there may be up to
Constraints
The sum of
Subtask 1 [20%]
Subtask 2 [40%]
Subtask 3 [40%]
No additional constraints.
Input Specification
The first line contains an integer
The next
Output Specification
For each test case, if no such permutation exists, output
Sample Input
2
4
3
Sample Output
3 1 4 2
-1
Explanation
For the first test case,
For the second test case, it is not possible for all adjacent absolute differences to be prime.
Comments