# -*- coding : utf-8 -*-

def insertion_sort(list):
    for i in range(1, len(list)):
        key = list[i]
        j = i - 1
        show_list(list)
        while(j >= 0 and list[j] > key):
            list[j+1] = list[j]
            j = j - 1
        list[j+1] = key
    show_list(list)
    return list

def show_list(list):
    i = 0;
    while(i < len(list)-1):
        print(list[i], end=" ")
        i = i + 1
    print(list[i])

list_length = int(input())
list = [int(x) for x in input().split(" ")]
insertion_sort(list) def insertion_sort(list):
    for i in range(1, len(list)):
        key = list[i]
        j = i - 1
        show_list(list)
        while(j >= 0 and list[j] > key):
            list[j+1] = list[j]
            j = j - 1
        list[j+1] = key
    show_list(list)
    return list insertion_sort for i in range(1, len(list)):
        key = list[i]
        j = i - 1
        show_list(list)
        while(j >= 0 and list[j] > key):
            list[j+1] = list[j]
            j = j - 1
        list[j+1] = key
     i range(1, len(list)) range 1 len(list) len list key = list[i] key list[i] list i j = i - 1 j i - 1 i 1 show_list(list) show_list list while(j >= 0 and list[j] > key):
            list[j+1] = list[j]
            j = j - 1
         j >= 0 and list[j] > key j >= 0 j 0 list[j] > key list[j] list j key list[j+1] = list[j] list[j+1] list j+1 j 1 list[j] list j j = j - 1 j j - 1 j 1 list[j+1] = key list[j+1] list j+1 j 1 key show_list(list) show_list list return list list list list def show_list(list):
    i = 0;
    while(i < len(list)-1):
        print(list[i], end=" ")
        i = i + 1
    print(list[i]) show_list i = 0 i 0 while(i < len(list)-1):
        print(list[i], end=" ")
        i = i + 1
     i < len(list)-1 i len(list)-1 len(list) len list 1 print(list[i], end=" ") print list[i] list i end=" " end " " i = i + 1 i i + 1 i 1 print(list[i]) print list[i] list i list list list_length = int(input()) list_length int(input()) int input() input int(x) for x in input().split(" ") for x in input().split(" ") x input().split(" ") ().split () input split " " for x in input().split(" ") int(x) int x list = [int(x) for x in input().split(" ")] list [int(x) for x in input().split(" ")] insertion_sort(list) insertion_sort list def show_list(list):
    i = 0;
    while(i < len(list)-1):
        print(list[i], end=" ")
        i = i + 1
    print(list[i]) def show_list(list):
    i = 0;
    while(i < len(list)-1):
        print(list[i], end=" ")
        i = i + 1
    print(list[i]) show_list list = [int(x) for x in input().split(" ")] [int(x) for x in input().split(" ")] list list_length = int(input()) int(input()) list_length def insertion_sort(list):
    for i in range(1, len(list)):
        key = list[i]
        j = i - 1
        show_list(list)
        while(j >= 0 and list[j] > key):
            list[j+1] = list[j]
            j = j - 1
        list[j+1] = key
    show_list(list)
    return list def insertion_sort(list):
    for i in range(1, len(list)):
        key = list[i]
        j = i - 1
        show_list(list)
        while(j >= 0 and list[j] > key):
            list[j+1] = list[j]
            j = j - 1
        list[j+1] = key
    show_list(list)
    return list insertion_sort
# -*- coding : utf-8 -*-

def insertion_sort(list):
    for i in range(1, len(list)):
        key = list[i]
        j = i - 1
        show_list(list)
        while(j >= 0 and list[j] > key):
            list[j+1] = list[j]
            j = j - 1
        list[j+1] = key
    show_list(list)
    return list

def show_list(list):
    i = 0;
    while(i < len(list)-1):
        print(list[i], end=" ")
        i = i + 1
    print(list[i])

list_length = int(input())
list = [int(x) for x in input().split(" ")]
insertion_sort(list)