Олимпиадный тренинг

Задача 31879. Anti-QuickSort (under development)


You are given a number N (1<=N<=1000) and then N natural numbers from the range 1 to 100.
Output a permutation of array elements on which quicksort will perform the maximum number of comparisons, provided that the "reference" there will be an element in the middle. 

Input: number N is given in the first line
The second line contains N numbers - array elements
Output: print the desired permutation of the elements of the original array

Examples
# Input Output
1 5
3 10 1 20 7
3 20 7 1 10