Weird Sort

No attempts yetTime limit1sMemory limit128 MB

Problem

You are given a sequence of NN integers a1,a2,,aNa_1, a_2, \dots, a_N. Reorder them so that no element is exactly one greater than the element immediately before it. Formally, the final sequence must satisfy ai+1ai+1a_{i+1} \neq a_i + 1 for every ii with 1i<N1 \le i < N.

If several orderings satisfy this condition, output the lexicographically smallest one.

Input

The input consists of several data sets. Each data set spans two lines. The first line contains the sequence length NN (1N500001 \le N \le 50000). The second line contains NN integers a1,a2,,aNa_1, a_2, \dots, a_N separated by single spaces, each satisfying ai109|a_i| \le 10^9. A line containing a single 00 marks the end of the input and is not processed.

Output

For each data set, print the resulting sequence on its own line, with integers separated by single spaces. If no valid ordering exists, print No solution instead.