# -*- Coding: utf-8 -*-
def trace(A, N):
    for i in range(int(N)-1):
        print(A[i], end=' ')
    print(A[int(N)-1])

def insertionSort(A, N):
    for i in range(1, int(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
        trace(A, N)

if __name__ == '__main__':
    N = input()
    A = list(map(int, input().split()))
    
    trace(A, N)
    insertionSort(A, N)
 def trace(A, N):
    for i in range(int(N)-1):
        print(A[i], end=' ')
    print(A[int(N)-1]) trace for i in range(int(N)-1):
        print(A[i], end=' ')
     i range(int(N)-1) range int(N)-1 int(N) int N 1 print(A[i], end=' ') print A[i] A i end=' ' end ' ' print(A[int(N)-1]) print A[int(N)-1] A int(N)-1 int(N) int N 1 A A N N def insertionSort(A, N):
    for i in range(1, int(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
        trace(A, N) insertionSort for i in range(1, int(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
        trace(A, N) i range(1, int(N)) range 1 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 -= 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 trace(A, N) trace A N A A N N if __name__ == '__main__':
    N = input()
    A = list(map(int, input().split()))
    
    trace(A, N)
    insertionSort(A, N) __name__ == '__main__' __name__ '__main__' N = input() N input() input A = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split trace(A, N) trace A N insertionSort(A, N) insertionSort A N def insertionSort(A, N):
    for i in range(1, int(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
        trace(A, N) def insertionSort(A, N):
    for i in range(1, int(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
        trace(A, N) insertionSort A = list(map(int, input().split())) list(map(int, input().split())) A N = input() input() N def trace(A, N):
    for i in range(int(N)-1):
        print(A[i], end=' ')
    print(A[int(N)-1]) def trace(A, N):
    for i in range(int(N)-1):
        print(A[i], end=' ')
    print(A[int(N)-1]) trace
# -*- Coding: utf-8 -*-
def trace(A, N):
    for i in range(int(N)-1):
        print(A[i], end=' ')
    print(A[int(N)-1])

def insertionSort(A, N):
    for i in range(1, int(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
        trace(A, N)

if __name__ == '__main__':
    N = input()
    A = list(map(int, input().split()))
    
    trace(A, N)
    insertionSort(A, N)

