def show_list(num_list):

    for i in range(len(num_list)):

        print(str(num_list[i]), end="")

        if i < len(num_list)-1:

            print(" ", end="")

        else:

            print()



input_num = int(input())

num_list = [int(i) for i in input().split()]

show_list(num_list)

for i in range(1, len(num_list)):

    v = num_list[i]

    j = i - 1

    while j >= 0 and num_list[j] > v:

        num_list[j+1] = num_list[j]

        j -= 1

    num_list[j+1] = v

    show_list(num_list)

# -*- 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 show_list(num_list):
    for i in range(len(num_list)):
        print(str(num_list[i]), end="")
        if i < len(num_list) - 1:
            print(" ", end="")
        else:
            print()


input_num = int(input())
num_list = [int(i) for i in input().split()]
show_list(num_list)
for i in range(1, len(num_list)):
    v = num_list[i]
    j = i - 1
    while j >= 0 and num_list[j] > v:
        num_list[j + 1] = num_list[j]
        j -= 1
    num_list[j + 1] = v
    show_list(num_list)

# -*- 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 show_list(num_list): -    for i in range(len(num_list)): -        print(str(num_list[i]), end="") -        if i < len(num_list) - 1: -            print(" ", end="") -        else: -            print() +# -*- 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 -input_num = int(input()) -num_list = [int(i) for i in input().split()] -show_list(num_list) -for i in range(1, len(num_list)): -    v = num_list[i] -    j = i - 1 -    while j >= 0 and num_list[j] > v: -        num_list[j + 1] = num_list[j] -        j -= 1 -    num_list[j + 1] = v -    show_list(num_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)