407168: GYM102697 139 Dynamic Sorting
Description
Your computer outputs $$$n$$$ integers randomly. You think it might be a secret code, so you decide to make a list of the numbers, but maintain the list in sorted order as you add each number.
For example, if the computer output was $$$3$$$ $$$4$$$ $$$2$$$ $$$8$$$ $$$7$$$, you would first add $$$3$$$ to the list, making the list [3].
Then, you would add $$$4$$$ to the list, making the list [3, 4].
Then, you add $$$2$$$, putting it first in the list to maintain the list's sorted order. The list becomes [2, 3, 4]
The process proceeds until the list is [2, 3, 4, 7, 8] after the final step.
InputThe first line of input contains a positive integer $$$n$$$: the amount of numbers your computer has printed out.
The next $$$n$$$ lines contain $$$n$$$ integers: the numbers that your computer printed out.
OutputOutput $$$n$$$ lines. On the $$$k$$$th line, output $$$k$$$ integers: the sorted list after adding the $$$k$$$th number from the computer's output to the list.
ExampleInput5 3 4 2 8 7Output
3 3 4 2 3 4 2 3 4 8 2 3 4 7 8