def insert_sort(A):
    for i in range(1, len(A)):
        k = A[i]
        j = i - 1
        while j >= 0 and A[j] > k:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = k
        show(A)

def show(A):
    for i in range(len(A) - 1):
        print(A[i], end=" ")
    print(A[len(A) - 1])

n =  int(input())
line = input()
A = list(map(int, line.split()))
show(A)
insert_sort(A) def insert_sort(A):
    for i in range(1, len(A)):
        k = A[i]
        j = i - 1
        while j >= 0 and A[j] > k:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = k
        show(A) insert_sort for i in range(1, len(A)):
        k = A[i]
        j = i - 1
        while j >= 0 and A[j] > k:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = k
        show(A) i range(1, len(A)) range 1 len(A) len A k = A[i] k A[i] A i j = i - 1 j i - 1 i 1 while j >= 0 and A[j] > k:
            A[j + 1] = A[j]
            j -= 1
         j >= 0 and A[j] > k j >= 0 j 0 A[j] > k A[j] A j k A[j + 1] = A[j] A[j + 1] A j + 1 j 1 A[j] A j j -= 1 j 1 A[j + 1] = k A[j + 1] A j + 1 j 1 k show(A) show A A A def show(A):
    for i in range(len(A) - 1):
        print(A[i], end=" ")
    print(A[len(A) - 1]) show for i in range(len(A) - 1):
        print(A[i], end=" ")
     i range(len(A) - 1) range len(A) - 1 len(A) len A 1 print(A[i], end=" ") print A[i] A i end=" " end " " print(A[len(A) - 1]) print A[len(A) - 1] A len(A) - 1 len(A) len A 1 A A n =  int(input()) n int(input()) int input() input line = input() line input() input A = list(map(int, line.split())) A list(map(int, line.split())) list map(int, line.split()) map int line.split() line.split line split show(A) show A insert_sort(A) insert_sort A def show(A):
    for i in range(len(A) - 1):
        print(A[i], end=" ")
    print(A[len(A) - 1]) def show(A):
    for i in range(len(A) - 1):
        print(A[i], end=" ")
    print(A[len(A) - 1]) show n =  int(input()) int(input()) n def insert_sort(A):
    for i in range(1, len(A)):
        k = A[i]
        j = i - 1
        while j >= 0 and A[j] > k:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = k
        show(A) def insert_sort(A):
    for i in range(1, len(A)):
        k = A[i]
        j = i - 1
        while j >= 0 and A[j] > k:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = k
        show(A) insert_sort line = input() input() line A = list(map(int, line.split())) list(map(int, line.split())) A
def insert_sort(A):
    for i in range(1, len(A)):
        k = A[i]
        j = i - 1
        while j >= 0 and A[j] > k:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = k
        show(A)

def show(A):
    for i in range(len(A) - 1):
        print(A[i], end=" ")
    print(A[len(A) - 1])

n =  int(input())
line = input()
A = list(map(int, line.split()))
show(A)
insert_sort(A)