def isort(seq, n):
    for i in range(1, n):
        x = seq[i]
        j = i - 1
        while j >= 0 and seq[j] > x:
            seq[j + 1] = seq[j]
            j -= 1
        seq[j + 1] = x
        print(*seq)


n = int(input())

x = list(map(int, input().split()))
print(*x)
isort(x, n) def isort(seq, n):
    for i in range(1, n):
        x = seq[i]
        j = i - 1
        while j >= 0 and seq[j] > x:
            seq[j + 1] = seq[j]
            j -= 1
        seq[j + 1] = x
        print(*seq) isort for i in range(1, n):
        x = seq[i]
        j = i - 1
        while j >= 0 and seq[j] > x:
            seq[j + 1] = seq[j]
            j -= 1
        seq[j + 1] = x
        print(*seq) i range(1, n) range 1 n x = seq[i] x seq[i] seq i j = i - 1 j i - 1 i 1 while j >= 0 and seq[j] > x:
            seq[j + 1] = seq[j]
            j -= 1
         j >= 0 and seq[j] > x j >= 0 j 0 seq[j] > x seq[j] seq j x seq[j + 1] = seq[j] seq[j + 1] seq j + 1 j 1 seq[j] seq j j -= 1 j 1 seq[j + 1] = x seq[j + 1] seq j + 1 j 1 x print(*seq) print *seq seq seq seq n n n = int(input()) n int(input()) int input() input x = list(map(int, input().split())) x list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split print(*x) print *x x isort(x, n) isort x n n = int(input()) int(input()) n def isort(seq, n):
    for i in range(1, n):
        x = seq[i]
        j = i - 1
        while j >= 0 and seq[j] > x:
            seq[j + 1] = seq[j]
            j -= 1
        seq[j + 1] = x
        print(*seq) def isort(seq, n):
    for i in range(1, n):
        x = seq[i]
        j = i - 1
        while j >= 0 and seq[j] > x:
            seq[j + 1] = seq[j]
            j -= 1
        seq[j + 1] = x
        print(*seq) isort x = list(map(int, input().split())) list(map(int, input().split())) x
def isort(seq, n):
    for i in range(1, n):
        x = seq[i]
        j = i - 1
        while j >= 0 and seq[j] > x:
            seq[j + 1] = seq[j]
            j -= 1
        seq[j + 1] = x
        print(*seq)


n = int(input())

x = list(map(int, input().split()))
print(*x)
isort(x, n)