An integer sequence a_1,a_2,…,a_n is good if m_1≤m_2≤⋯≤m_n where m_i is the median of a_1,a_2,…,a_i.
Given a sequence p_1,p_2,…,p_n, find its permutation which is good. If the result is not unique, find the lexicographically largest one.
For a sequence a_1,a_2,…,a_n, the median is the ⌈n/2⌉-th largest element if n is odd, or the average of the n/2-th largest and the (n/2+1)-th largest elements if n is even.
The first line contains an integer n (1≤n≤105).
The second line contains n integers p_1,p_2,…,p_n (1≤p_i≤109).
On the first line, print n integers which denote the lexicographically largest good permutation of the input sequence.