408029: GYM102964 C Find the order
Description
You are given an array of $$$n$$$ positive integers. You should determine is it possible to reorder it's elements in such a way that condition $$$a_1 < a_2 > a_3 < a_4 > a_5... $$$ is true. In other words, first element should be strictly less than the second, the second element should be strictly greater than the third etc. If such order exists output $$$n$$$ numbers – the resulting array. If no, just output $$$-1$$$. If there are more than one correct order output any of correct arrays.
InputIn first line you are given number $$$n$$$, $$$1 \le n \le 10^5$$$ – number of elements in array. In the second line you are given $$$n$$$ positive integers $$$1 \le a_i \le 10^9$$$ – array itself.
OutputOutput correct order if it exists or $$$-1$$$ if no. Output elements not indices.
ExamplesInput5 1 2 3 4 1Output
1 3 1 4 2Input
4 1 1 1 1Output
-1