Find the previous permutation in lexicographical order.
For the permutation 1, 2, 3, \ldots, N-1, N, the previous permutation is N, N-1, \ldots, 3, 2, 1.
The first line of the input contains the integer (1 \leq N \leq 10^5), representing the number of elements in the permutation. The second line provides the permutation itself.
Output numbers representing the desired permutation.
Example 1