I. Ideal Permutation Pairing
time limit per test
1 second
memory limit per test
512 megabytes
input
standard input
output
standard output

A permutation of size $$$N$$$ is a sequence of $$$N$$$ positive integers containing the numbers $$$1$$$ to $$$N$$$ where each number appears exactly once in the sequence. For example, $$$[1,4,5,3,2]$$$ is a permutation of size $$$5$$$, while $$$[1,1,4,3,5]$$$ and $$$[1,6,2,3,4]$$$ are not.

We can compare two permutations using lexicographical order. For two permutations $$$p$$$ and $$$p$$$ of the same size $$$N$$$ where $$$p = [a_1,a_2,...,a_N]$$$ and $$$q = [b_1,b_2,...,b_N]$$$, we define $$$p$$$ is smaller than $$$q$$$ if and only if there exists an index $$$i$$$ such that $$$a_j=b_j$$$ for every $$$j \lt i$$$ and $$$a_i \lt b_i$$$. For example, $$$[1,3,4,2,5]$$$ is ordered before $$$[1,3,5,2,4]$$$.

Two permutations $$$p$$$ and $$$q$$$ of size $$$N$$$ are considered an ideal pair if, when all $$$N!$$$ permutations of size $$$N$$$ are arranged in a circle based on lexicographic order, permutation $$$p$$$ and permutation $$$q$$$ are positioned directly opposite each other in the circle.

Figure I.1: Example of the circle of permutations of size $$$3$$$.

Given a permutation $$$p$$$, your task is to identify the permutation $$$q$$$ that together forms an ideal pair.

Input

The first line contains one integer $$$N$$$ $$$(2\le N \le 1,000,000)$$$ — size of the permutation.

The second line contains $$$N$$$ distinct integers from $$$1$$$ to $$$N$$$ — the given permutation $$$p$$$.

Output

One line contains $$$N$$$ distinct integers that are the permutation that forms an ideal pair with permutation $$$p$$$.

Examples
Input
3
1 2 3
Output
2 3 1
Input
4
3 2 1 4
Output
1 3 2 4
Input
9
7 4 6 9 5 3 8 2 1
Output
2 9 6 8 5 4 7 3 1