n = int(input()) a = list(map(int, input().split())) for i in range(2 * n - 3): for k in range(min(i + 1, n)): for j in range(k + 1, min(i + 1, n)): if k + j == i and a[k] > a[j]: a[k], a[j] = a[j], a[k] print(" ".join(map(str, a)))