def insertionSort():
    N = int(input())
    lst = list(map(int, input().split()))
    
    for i in range(1, N):
        print(*lst)
        v = lst[i]
        j = i - 1
        while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j -= 1
        lst[j+1] = v
    
    print(*lst)
        
insertionSort() def insertionSort():
    N = int(input())
    lst = list(map(int, input().split()))
    
    for i in range(1, N):
        print(*lst)
        v = lst[i]
        j = i - 1
        while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j -= 1
        lst[j+1] = v
    
    print(*lst)
         insertionSort N = int(input()) N int(input()) int input() input lst = list(map(int, input().split())) lst list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for i in range(1, N):
        print(*lst)
        v = lst[i]
        j = i - 1
        while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j -= 1
        lst[j+1] = v
    
     i range(1, N) range 1 N print(*lst) print *lst lst v = lst[i] v lst[i] lst i j = i - 1 j i - 1 i 1 while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j -= 1
         j >= 0 and lst[j] > v j >= 0 j 0 lst[j] > v lst[j] lst j v lst[j+1] = lst[j] lst[j+1] lst j+1 j 1 lst[j] lst j j -= 1 j 1 lst[j+1] = v lst[j+1] lst j+1 j 1 v print(*lst) print *lst lst insertionSort() insertionSort def insertionSort():
    N = int(input())
    lst = list(map(int, input().split()))
    
    for i in range(1, N):
        print(*lst)
        v = lst[i]
        j = i - 1
        while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j -= 1
        lst[j+1] = v
    
    print(*lst)
         def insertionSort():
    N = int(input())
    lst = list(map(int, input().split()))
    
    for i in range(1, N):
        print(*lst)
        v = lst[i]
        j = i - 1
        while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j -= 1
        lst[j+1] = v
    
    print(*lst)
         insertionSort
def insertionSort():
    N = int(input())
    lst = list(map(int, input().split()))
    
    for i in range(1, N):
        print(*lst)
        v = lst[i]
        j = i - 1
        while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j -= 1
        lst[j+1] = v
    
    print(*lst)
        
insertionSort()