Problems
What is Bubble Sort? It is a method of sorting by repeatedly comparing and swapping adjacent elements.
The sorting process is as follows:
Compare the first and second values; if the first value is larger, swap them.
Compare the second and third values; if the second value is larger, swap them.
Repeat this process until comparing the N-1th and Nth values; if the N-1th value is larger, swap them.
At the end of this step, the largest value will be in the Nth position (one step completed).
Next, repeat steps 1–3 excluding the Nth value; then the second largest value will be in the N-1th position (second step completed).
By repeating this process N-1 times, all the data will be sorted in order.
For example, given the sequence {62, 23, 32, 15}, it is sorted in the following manner.
Input
The first line contains the length of the sequence N (4 ≤ N ≤ 100).
The second line contains N integers between 0 and 100 inclusive.
Output
Excluding the initial state, print the sequence after each step of the bubble sort.
Each step should be printed on a separate line, following the output format in the example.
Example
4
62 23 32 15
23 32 15 62
23 15 32 62
15 23 32 62