#C573. Bubble Sort for Book Heights

    ID: 49411 Type: Default 1000ms 256MiB

Bubble Sort for Book Heights

Bubble Sort for Book Heights

You are given the heights of n books in a list. Your task is to implement the Bubble Sort algorithm to sort this list in ascending order.

The bubble sort algorithm works by repeatedly swapping adjacent elements if they are in the wrong order. This process is repeated until the list is sorted. The time complexity of the algorithm is \(O(n^2)\) in the worst case.

Please read the input from stdin and output the sorted list to stdout. Ensure your function passes all the given test cases.

inputFormat

The first line contains an integer n, the number of books. The second line contains n space-separated integers representing the heights of the books.

outputFormat

Output the sorted list of book heights in ascending order as space-separated integers in a single line.

## sample
5
5 3 8 6 2
2 3 5 6 8