def show(array):

    for i in range(len(array)):

        if i != len(array) - 1:

            print(array[i], end=' ')

        else:

            print(array[i])



length = int(input())

array = [int(x) for x in input().split()]



for i in range(length):

    v = array[i]

    j = i-1

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

        array[j+1] = array[j]

        j -= 1

    array[j+1] = v

    show(array)



def insertionSort(a):

    n = len(a)

    print((*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 += -1

        a[j+1] = v

        print((*a))





n = int(eval(input()))

a = [int(x) for x in input().split()]



insertionSort(a)

def show(array):
    for i in range(len(array)):
        if i != len(array) - 1:
            print(array[i], end=" ")
        else:
            print(array[i])


length = int(input())
array = [int(x) for x in input().split()]
for i in range(length):
    v = array[i]
    j = i - 1
    while j >= 0 and array[j] > v:
        array[j + 1] = array[j]
        j -= 1
    array[j + 1] = v
    show(array)

def insertionSort(a):
    n = len(a)
    print((*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 += -1
        a[j + 1] = v
        print((*a))


n = int(eval(input()))
a = [int(x) for x in input().split()]
insertionSort(a)

-def show(array): -    for i in range(len(array)): -        if i != len(array) - 1: -            print(array[i], end=" ") -        else: -            print(array[i]) +def insertionSort(a): +    n = len(a) +    print((*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 += -1 +        a[j + 1] = v +        print((*a)) -length = int(input()) -array = [int(x) for x in input().split()] -for i in range(length): -    v = array[i] -    j = i - 1 -    while j >= 0 and array[j] > v: -        array[j + 1] = array[j] -        j -= 1 -    array[j + 1] = v -    show(array) +n = int(eval(input())) +a = [int(x) for x in input().split()] +insertionSort(a)