#668. Swap the largest and the smallest
Swap the largest element (its first appearance) and the smallest element (its first appearance).
### Input
The first line has n, the second line has n integers separated by spaces.
### Output
One line.
Examples
Input
7 39 33 6 38 16 39 4
Output
4 33 6 38 16 39 39
Input
6 35 6 30 23 20 31
Output
6 35 30 23 20 31
💡 You can solve it with Python, JavaScript or blocks. Read the input line by line with input(). Don't print a question (like input("Number: ")). Print exactly what the output asks for, nothing more.