import sys
def print_list(A):
    for k in range(len(A)):
        sys.stdout.write(str(A[k]))
        if not k == len(A) -1: sys.stdout.write(" ")
    print()
def insert_sort(A,N):
    print_list(A)
    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 = j-1
        A[j+1]=v
        print_list(A)


N = int(input())
A = list(map(int,input().split()))
insert_sort(A,N) import sys sys def print_list(A):
    for k in range(len(A)):
        sys.stdout.write(str(A[k]))
        if not k == len(A) -1: sys.stdout.write(" ")
    print() print_list for k in range(len(A)):
        sys.stdout.write(str(A[k]))
        if not k == len(A) -1: sys.stdout.write(" ")
     k range(len(A)) range len(A) len A sys.stdout.write(str(A[k])) sys.stdout.write sys.stdout sys stdout write str(A[k]) str A[k] A k if not k == len(A) -1: sys.stdout.write(" ")
     not k == len(A) -1 k == len(A) -1 k len(A) -1 len(A) len A 1 print() print A A def insert_sort(A,N):
    print_list(A)
    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 = j-1
        A[j+1]=v
        print_list(A) insert_sort print_list(A) print_list A 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 = j-1
        A[j+1]=v
        print_list(A) 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 = 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 = j-1 j j-1 j 1 A[j+1]=v A[j+1] A j+1 j 1 v print_list(A) print_list A A A N N N = int(input()) N int(input()) int 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 insert_sort(A,N) insert_sort A N A = list(map(int,input().split())) list(map(int,input().split())) A def insert_sort(A,N):
    print_list(A)
    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 = j-1
        A[j+1]=v
        print_list(A) def insert_sort(A,N):
    print_list(A)
    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 = j-1
        A[j+1]=v
        print_list(A) insert_sort N = int(input()) int(input()) N def print_list(A):
    for k in range(len(A)):
        sys.stdout.write(str(A[k]))
        if not k == len(A) -1: sys.stdout.write(" ")
    print() def print_list(A):
    for k in range(len(A)):
        sys.stdout.write(str(A[k]))
        if not k == len(A) -1: sys.stdout.write(" ")
    print() print_list
import sys
def print_list(A):
    for k in range(len(A)):
        sys.stdout.write(str(A[k]))
        if not k == len(A) -1: sys.stdout.write(" ")
    print()
def insert_sort(A,N):
    print_list(A)
    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 = j-1
        A[j+1]=v
        print_list(A)


N = int(input())
A = list(map(int,input().split()))
insert_sort(A,N)