# coding:utf-8

def insertionSort(A, N):
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        for i in A:
            print i,
        else:
            print

N = input()
A = map(int, raw_input().split())
for i in A:
    print i,
else:
    print
insertionSort(A,N) def insertionSort(A, N):
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        for i in A:
            print i,
        else:
            print insertionSort for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        for i in A:
            print i,
        else:
            print i range(1, N) range 1 N v = A[i] v A[i] A i j = i - 1 j i - 1 i 1 while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
         j >= 0 and A[j] > v j >= 0 j 0 A[j] > v A[j] A j v A[j + 1] = A[j] A[j + 1] A j + 1 j 1 A[j] A j j -= 1 j 1 A[j + 1] = v A[j + 1] A j + 1 j 1 v for i in A:
            print i,
        else:
            print i A print i print A A N N N = input() N input() input A = map(int, raw_input().split()) A map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split for i in A:
    print i,
else:
    print i A print i print insertionSort(A,N) insertionSort A N N = input() input() N def insertionSort(A, N):
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        for i in A:
            print i,
        else:
            print def insertionSort(A, N):
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        for i in A:
            print i,
        else:
            print insertionSort A = map(int, raw_input().split()) map(int, raw_input().split()) A
# coding:utf-8

def insertionSort(A, N):
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        for i in A:
            print i,
        else:
            print

N = input()
A = map(int, raw_input().split())
for i in A:
    print i,
else:
    print
insertionSort(A,N)