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