def insertionSort(a,n):
    for i in range(n):
        print(a[i],end="")
        if(i!=n-1):
            print(" ",end="")
    print("")    
    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 range(n):
            print(a[i],end="")
            if(i!=n-1):
                print(" ",end="")
        print("")

a=[]
n=int(input())
s=input()
a=list(map(int,s.split()))
insertionSort(a,n) def insertionSort(a,n):
    for i in range(n):
        print(a[i],end="")
        if(i!=n-1):
            print(" ",end="")
    print("")    
    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 range(n):
            print(a[i],end="")
            if(i!=n-1):
                print(" ",end="")
        print("") insertionSort for i in range(n):
        print(a[i],end="")
        if(i!=n-1):
            print(" ",end="")
     i range(n) range n print(a[i],end="") print a[i] a i end="" end "" if(i!=n-1):
            print(" ",end="")
     i!=n-1 i n-1 n 1 print(" ",end="") print " " end="" end "" print("") print "" 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 range(n):
            print(a[i],end="")
            if(i!=n-1):
                print(" ",end="")
        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 range(n):
            print(a[i],end="")
            if(i!=n-1):
                print(" ",end="")
         i range(n) range n print(a[i],end="") print a[i] a i end="" end "" if(i!=n-1):
                print(" ",end="")
         i!=n-1 i n-1 n 1 print(" ",end="") print " " end="" end "" print("") print "" a a n n a=[] a [] n=int(input()) n int(input()) int input() input s=input() s input() input a=list(map(int,s.split())) a list(map(int,s.split())) list map(int,s.split()) map int s.split() s.split s split insertionSort(a,n) insertionSort a n n=int(input()) int(input()) n a=list(map(int,s.split())) list(map(int,s.split())) a a=[] [] a def insertionSort(a,n):
    for i in range(n):
        print(a[i],end="")
        if(i!=n-1):
            print(" ",end="")
    print("")    
    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 range(n):
            print(a[i],end="")
            if(i!=n-1):
                print(" ",end="")
        print("") def insertionSort(a,n):
    for i in range(n):
        print(a[i],end="")
        if(i!=n-1):
            print(" ",end="")
    print("")    
    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 range(n):
            print(a[i],end="")
            if(i!=n-1):
                print(" ",end="")
        print("") insertionSort s=input() input() s
def insertionSort(a,n):
    for i in range(n):
        print(a[i],end="")
        if(i!=n-1):
            print(" ",end="")
    print("")    
    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 range(n):
            print(a[i],end="")
            if(i!=n-1):
                print(" ",end="")
        print("")

a=[]
n=int(input())
s=input()
a=list(map(int,s.split()))
insertionSort(a,n)