PROGRAMMING:Heap sort
For n numbers, heap sort (maximum heap) is required to sort them.
###Input format:
The first line has an n (n < 1000). The second line gives n numbers.
###Output format:
Output n lines, n numbers per line. The first row represents the result after n numbers (n numbers are regarded as a tree) are changed into the maximum heap, the second row represents the result after the root node of the last result is exchanged to the last node of the existing node (then the number except the last node is regarded as a tree), and then the result output (including the exchange to the last node) after the remaining node tree is changed into the maximum heap again, and so on.
###Input example:
```in
six
7 1 6 4 3 5
```
###Output example:
```out
7 4 6 1 3 5
6 4 5 1 3 7
5 4 3 1 6 7
4 1 3 5 6 7
3 1 4 5 6 7
1 3 4 5 6 7
```
answer:If there is no answer, please comment
###Input format:
The first line has an n (n < 1000). The second line gives n numbers.
###Output format:
Output n lines, n numbers per line. The first row represents the result after n numbers (n numbers are regarded as a tree) are changed into the maximum heap, the second row represents the result after the root node of the last result is exchanged to the last node of the existing node (then the number except the last node is regarded as a tree), and then the result output (including the exchange to the last node) after the remaining node tree is changed into the maximum heap again, and so on.
###Input example:
```in
six
7 1 6 4 3 5
```
###Output example:
```out
7 4 6 1 3 5
6 4 5 1 3 7
5 4 3 1 6 7
4 1 3 5 6 7
3 1 4 5 6 7
1 3 4 5 6 7
```
answer:If there is no answer, please comment