CodeLab Academy 📞 9936 6696
← List Python · Level 8: Nested loops Code · 80 points ← #772 #774 →

#773. Bubble sort (every step)

Print the list after each step of the outer loop of bubble sort (n-1 steps, do not stop early). ### Input The first line has n, the second line has n integers separated by spaces. (n ≥ 2) ### Output n-1 lines.

Examples

Input
5
8 12 8 7 6
Output
8 8 7 6 12
8 7 6 8 12
7 6 8 8 12
6 7 8 8 12
Input
2
0 9
Output
0 9

💡 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.

🔒 You can solve the first 3 problems without an account. Sign up for free to solve this one!