Hide

Problem A
Star Wars röðun

Languages en is
/problems/starwars2/file/statement/en/img-0001.png
Image from cjsort
As many know, the Star Wars movies are numbered rather oddly. The films are numbered as follows in publishing order: Episode 4, Episode 5, Episode 6, Episode 1, Episode 2, Episode 3, Episode 7, Episode 8, Episode 9.

We define starwars-order, as an operation on a list of numbers, such that if the list is ordered, the first third moves to the center, the center third moves to the front and the last third stays put.

The problem is as follows, given a list of numbers, give their starwars-order.
For example for the Star wars movies, the starwars-order of $1, 2, 3, 4, 5, 6, 7, 8, 9$ would be $4, 5, 6, 1, 2, 3, 7, 8, 9$.

Input

The first line contains a single integer $n$, the number of numbers where $n$ is a multiple of $3$. The second line contains $n$ different integers separated by spaces, where each value $x$ satisfies $1 \leq x \leq 10^9$.

Output

The starwars-order of the values in the input, given on a single line, separated by spaces.

Scoring

Group

Points

Constraints

1

20

$n = 9$

2

80

$3 \leq n \leq 3*10^5$

Sample Input 1 Sample Output 1
9
1 2 3 4 5 6 7 8 9
4 5 6 1 2 3 7 8 9
Sample Input 2 Sample Output 2
3
5 9 10
9 5 10
Sample Input 3 Sample Output 3
6
6 55 1 3 8 34
6 8 1 3 34 55