n = int(input()) A = list(map(int, input().split())) for i in range(2 * n - 3): for j in range(i): p, q = j, i - j if 0 <= p < q <= n - 1 and A[p] > A[q]: A[p], A[q] = A[q], A[p] print(*A)