#ALDS1_1-A
def print_A(A,N):
    stri = ""
    for i in range(N-1):
        stri+=str(A[i])+" "
    stri+=str(A[N-1])
    print(stri)

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

N=int(input())
A=[int(x) for x in input().split()]
print_A(A,N)
insertionSort(A,N) def print_A(A,N):
    stri = ""
    for i in range(N-1):
        stri+=str(A[i])+" "
    stri+=str(A[N-1])
    print(stri) print_A stri = "" stri "" for i in range(N-1):
        stri+=str(A[i])+" "
     i range(N-1) range N-1 N 1 stri+=str(A[i])+" " stri str(A[i])+" " str(A[i]) str A[i] A i " " stri+=str(A[N-1]) stri str(A[N-1]) str A[N-1] A N-1 N 1 print(stri) print stri A A N N def insertionSort(A,N):
    for i in range(N-1):
        v=A[i+1]
        j=i
        while j>=0 and A[j]>v:
            A[j+1]=A[j]
            j-=1
        A[j+1]=v
        print_A(A,N) insertionSort for i in range(N-1):
        v=A[i+1]
        j=i
        while j>=0 and A[j]>v:
            A[j+1]=A[j]
            j-=1
        A[j+1]=v
        print_A(A,N) i range(N-1) range N-1 N 1 v=A[i+1] v A[i+1] A i+1 i 1 j=i j i 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_A(A,N) print_A A N A A N N N=int(input()) N int(input()) int input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x A=[int(x) for x in input().split()] A [int(x) for x in input().split()] print_A(A,N) print_A A N insertionSort(A,N) insertionSort A N A=[int(x) for x in input().split()] [int(x) for x in input().split()] A N=int(input()) int(input()) N def print_A(A,N):
    stri = ""
    for i in range(N-1):
        stri+=str(A[i])+" "
    stri+=str(A[N-1])
    print(stri) def print_A(A,N):
    stri = ""
    for i in range(N-1):
        stri+=str(A[i])+" "
    stri+=str(A[N-1])
    print(stri) print_A def insertionSort(A,N):
    for i in range(N-1):
        v=A[i+1]
        j=i
        while j>=0 and A[j]>v:
            A[j+1]=A[j]
            j-=1
        A[j+1]=v
        print_A(A,N) def insertionSort(A,N):
    for i in range(N-1):
        v=A[i+1]
        j=i
        while j>=0 and A[j]>v:
            A[j+1]=A[j]
            j-=1
        A[j+1]=v
        print_A(A,N) insertionSort
#ALDS1_1-A
def print_A(A,N):
    stri = ""
    for i in range(N-1):
        stri+=str(A[i])+" "
    stri+=str(A[N-1])
    print(stri)

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

N=int(input())
A=[int(x) for x in input().split()]
print_A(A,N)
insertionSort(A,N)