def sort(l):
    
    for i in range(len(l)) :
        key = l[i]
        j = i-1
        while j>=0 and l[j]>key:
            l[j+1] = l[j]
            j -= 1
            
        l[j+1] = key
        print(" ".join(map(str,l)))

n = int(input())
line = list(map(int,input().split(" ")))

sort(line) def sort(l):
    
    for i in range(len(l)) :
        key = l[i]
        j = i-1
        while j>=0 and l[j]>key:
            l[j+1] = l[j]
            j -= 1
            
        l[j+1] = key
        print(" ".join(map(str,l))) sort for i in range(len(l)) :
        key = l[i]
        j = i-1
        while j>=0 and l[j]>key:
            l[j+1] = l[j]
            j -= 1
            
        l[j+1] = key
        print(" ".join(map(str,l))) i range(len(l)) range len(l) len l key = l[i] key l[i] l i j = i-1 j i-1 i 1 while j>=0 and l[j]>key:
            l[j+1] = l[j]
            j -= 1
            
         j>=0 and l[j]>key j>=0 j 0 l[j]>key l[j] l j key l[j+1] = l[j] l[j+1] l j+1 j 1 l[j] l j j -= 1 j 1 l[j+1] = key l[j+1] l j+1 j 1 key print(" ".join(map(str,l))) print " ".join(map(str,l)) " ".join " " join map(str,l) map str l l l n = int(input()) n int(input()) int input() input line = list(map(int,input().split(" "))) line list(map(int,input().split(" "))) list map(int,input().split(" ")) map int input().split(" ") ().split () input split " " sort(line) sort line n = int(input()) int(input()) n def sort(l):
    
    for i in range(len(l)) :
        key = l[i]
        j = i-1
        while j>=0 and l[j]>key:
            l[j+1] = l[j]
            j -= 1
            
        l[j+1] = key
        print(" ".join(map(str,l))) def sort(l):
    
    for i in range(len(l)) :
        key = l[i]
        j = i-1
        while j>=0 and l[j]>key:
            l[j+1] = l[j]
            j -= 1
            
        l[j+1] = key
        print(" ".join(map(str,l))) sort line = list(map(int,input().split(" "))) list(map(int,input().split(" "))) line
def sort(l):
    
    for i in range(len(l)) :
        key = l[i]
        j = i-1
        while j>=0 and l[j]>key:
            l[j+1] = l[j]
            j -= 1
            
        l[j+1] = key
        print(" ".join(map(str,l)))

n = int(input())
line = list(map(int,input().split(" ")))

sort(line)