#C9540. Beautiful Array Construction
Beautiful Array Construction
Beautiful Array Construction
You are given an integer n and you are required to construct a beautiful array of length n. An array is called beautiful if for every two adjacent elements a and b in the array, the condition \(\gcd(a,b) > 1\) holds, where \(\gcd(a,b)\) represents the greatest common divisor of a and b.
If it is possible to construct such an array, print the array as a sequence of space-separated integers. Otherwise, print -1.
Note: For this problem, it can be shown that a beautiful array exists if and only if n is even.
inputFormat
The input consists of a single integer n (1 ≤ n ≤ 105), which represents the length of the array.
outputFormat
If a beautiful array of length n exists, output n space-separated integers forming the array. Otherwise, output -1.
## sample2
2 4