LearnPy Hub
← Arena
IntermediateRating 1300

Up and Down

Rearrange the numbers so that a[0] ≤ a[1] ≥ a[2] ≤ a[3] ...: sort, then swap each pair (1,2), (3,4), .... Print the result.

Input

n, then n integers.

Output

One line.

Sample 1

Input
6
3 5 2 1 6 4
Output
1 3 2 5 4 6

Sample 2

Input
1
1
Output
1
solution.py
Output appears here
Up and Down · Python Arena problem · LearnPy Hub