#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
?????\?????????

N ??????????´????????????°??? A ????????????????????????????????\????????????????????°????????????????????????????????????

1 insertionSort(A, N) // N??????????´??????????0-?????????????????????A
2   for i ??? 1 ?????? N-1 ?????§
3     v = A[i]
4     j = i - 1
5     while j >= 0 ?????? A[j] > v
6       A[j+1] = A[j]
7       j--
8     A[j+1] = v

????????????????????????????????¢?????´????????????????£??????????????????????
??¢?????´??????????????????????¢???????????????????????¨??????????????????§?????????
?????\?????´??????????????¨?????? i ??????????????????????????´?????????????????????????????????????????????

"""

def iSort(A,N):
    """ ?????\????????? """
    print(" ".join(map(str,A)))
    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
        print(" ".join(map(str,A)))

# ?????????
num = int(input().strip())
arr = list(map(int,input().strip().split()))
iSort(arr,num) """
?????\?????????

N ??????????´????????????°??? A ????????????????????????????????\????????????????????°????????????????????????????????????

1 insertionSort(A, N) // N??????????´??????????0-?????????????????????A
2   for i ??? 1 ?????? N-1 ?????§
3     v = A[i]
4     j = i - 1
5     while j >= 0 ?????? A[j] > v
6       A[j+1] = A[j]
7       j--
8     A[j+1] = v

????????????????????????????????¢?????´????????????????£??????????????????????
??¢?????´??????????????????????¢???????????????????????¨??????????????????§?????????
?????\?????´??????????????¨?????? i ??????????????????????????´?????????????????????????????????????????????

""" def iSort(A,N):
    """ ?????\????????? """
    print(" ".join(map(str,A)))
    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
        print(" ".join(map(str,A)))

# ????????? iSort """ ?????\????????? """ print(" ".join(map(str,A))) print " ".join(map(str,A)) " ".join " " join map(str,A) map str A 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
        print(" ".join(map(str,A)))

# ????????? 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 print(" ".join(map(str,A))) print " ".join(map(str,A)) " ".join " " join map(str,A) map str A A A N N num = int(input().strip()) num int(input().strip()) int input().strip() ().strip () input strip arr = list(map(int,input().strip().split())) arr list(map(int,input().strip().split())) list map(int,input().strip().split()) map int input().strip().split() ().strip().split ().strip() ().strip () input strip split iSort(arr,num) iSort arr num arr = list(map(int,input().strip().split())) list(map(int,input().strip().split())) arr num = int(input().strip()) int(input().strip()) num def iSort(A,N):
    """ ?????\????????? """
    print(" ".join(map(str,A)))
    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
        print(" ".join(map(str,A)))

# ????????? def iSort(A,N):
    """ ?????\????????? """
    print(" ".join(map(str,A)))
    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
        print(" ".join(map(str,A)))

# ????????? iSort
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
?????\?????????

N ??????????´????????????°??? A ????????????????????????????????\????????????????????°????????????????????????????????????

1 insertionSort(A, N) // N??????????´??????????0-?????????????????????A
2   for i ??? 1 ?????? N-1 ?????§
3     v = A[i]
4     j = i - 1
5     while j >= 0 ?????? A[j] > v
6       A[j+1] = A[j]
7       j--
8     A[j+1] = v

????????????????????????????????¢?????´????????????????£??????????????????????
??¢?????´??????????????????????¢???????????????????????¨??????????????????§?????????
?????\?????´??????????????¨?????? i ??????????????????????????´?????????????????????????????????????????????

"""

def iSort(A,N):
    """ ?????\????????? """
    print(" ".join(map(str,A)))
    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
        print(" ".join(map(str,A)))

# ?????????
num = int(input().strip())
arr = list(map(int,input().strip().split()))
iSort(arr,num)