#coding:UTF-8
def IS(N,A):
    for i in range(int(N)):
        v=A[i]
        j=i-1
        while j>=0 and A[j]>v:
            A[j+1]=A[j]
            j=j-1
        A[j+1]=v
        ans=""
        for k in range(len(A)):
            ans+=str(A[k])+" "
        print(ans[:-1])

if __name__=="__main__":
    N=input()
    a=input()
    A=a.split(" ")
    for i in range(len(A)):
        A[i]=int(A[i])
    IS(N,A) def IS(N,A):
    for i in range(int(N)):
        v=A[i]
        j=i-1
        while j>=0 and A[j]>v:
            A[j+1]=A[j]
            j=j-1
        A[j+1]=v
        ans=""
        for k in range(len(A)):
            ans+=str(A[k])+" "
        print(ans[:-1]) IS for i in range(int(N)):
        v=A[i]
        j=i-1
        while j>=0 and A[j]>v:
            A[j+1]=A[j]
            j=j-1
        A[j+1]=v
        ans=""
        for k in range(len(A)):
            ans+=str(A[k])+" "
        print(ans[:-1]) i range(int(N)) range int(N) int 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=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=j-1 j j-1 j 1 A[j+1]=v A[j+1] A j+1 j 1 v ans="" ans "" for k in range(len(A)):
            ans+=str(A[k])+" "
         k range(len(A)) range len(A) len A ans+=str(A[k])+" " ans str(A[k])+" " str(A[k]) str A[k] A k " " print(ans[:-1]) print ans[:-1] ans :-1 -1 N N A A if __name__=="__main__":
    N=input()
    a=input()
    A=a.split(" ")
    for i in range(len(A)):
        A[i]=int(A[i])
    IS(N,A) __name__=="__main__" __name__ "__main__" N=input() N input() input a=input() a input() input A=a.split(" ") A a.split(" ") a.split a split " " for i in range(len(A)):
        A[i]=int(A[i])
     i range(len(A)) range len(A) len A A[i]=int(A[i]) A[i] A i int(A[i]) int A[i] A i IS(N,A) IS N A def IS(N,A):
    for i in range(int(N)):
        v=A[i]
        j=i-1
        while j>=0 and A[j]>v:
            A[j+1]=A[j]
            j=j-1
        A[j+1]=v
        ans=""
        for k in range(len(A)):
            ans+=str(A[k])+" "
        print(ans[:-1]) def IS(N,A):
    for i in range(int(N)):
        v=A[i]
        j=i-1
        while j>=0 and A[j]>v:
            A[j+1]=A[j]
            j=j-1
        A[j+1]=v
        ans=""
        for k in range(len(A)):
            ans+=str(A[k])+" "
        print(ans[:-1]) IS a=input() input() a A=a.split(" ") a.split(" ") A N=input() input() N
#coding:UTF-8
def IS(N,A):
    for i in range(int(N)):
        v=A[i]
        j=i-1
        while j>=0 and A[j]>v:
            A[j+1]=A[j]
            j=j-1
        A[j+1]=v
        ans=""
        for k in range(len(A)):
            ans+=str(A[k])+" "
        print(ans[:-1])

if __name__=="__main__":
    N=input()
    a=input()
    A=a.split(" ")
    for i in range(len(A)):
        A[i]=int(A[i])
    IS(N,A)