Kevin's Cards


Submit solution

Points: 1
Time limit: 2.0s
Python 3 3.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C, C++, Java, Python, Rust

Kevin is playing a card game with his three friends, Tuga, Messy Kevin, and Klevin. This game is played with a special big deck of cards, such that each player is dealt n cards labelled 1 to n.

To best strategise for the game before it starts, Kevin wants to arrange his hand of cards in a particular manner. Kevin wants to arrange his cards such that no two adjacent cards have a difference of 1. Specifically, for all i\in [1,n), |a_i - a_{i-1}| \neq 1. Can you tell Kevin one such arrangement of the cards, or let him know if it is impossible?

Input

The input consists of a single integer n (1 \leq n \leq 10^6), the number of cards each player will be dealt in this game. The cards of Kevin's hand are labelled 1 through n.

Output

If it is possible to arrange the numbers 1,\dots,n such that no two adjacent cards have an absolute difference of 1, output any of the arrangements on a single line, separated by spaces. Any valid arrangement will be accepted.

If it is impossible, output Impossible.

Example

Input 1
5
Output 1
1 3 5 2 4
Input 2
3
Output 2
Impossible

There is no way to arrange 1 2 3 in a valid manner. We can simply enumerate all permutations and check that none of them work: 1 2 3, 1 3 2, 2 1 3, 2 3 1, 3 1 2, 3 2 1.


Comments

There are no comments at the moment.