# coding: utf-8

n = int(eval(input()))

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



for i in range(n):

    v = data[i]

    j = i - 1

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

        data[j+1] = data[j]

        j -= 1

    data[j+1] = v

    print((*data))


def InsertionSort(A, N):



    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(a) for a in input().split()]



InsertionSort(A, N)
# coding: utf-8
n = int(eval(input()))
data = [int(i) for i in input().split()]
for i in range(n):
    v = data[i]
    j = i - 1
    while j >= 0 and data[j] > v:
        data[j + 1] = data[j]
        j -= 1
    data[j + 1] = v
    print((*data))

def InsertionSort(A, N):
    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(a) for a in input().split()]
InsertionSort(A, N)

-# coding: utf-8 -n = int(eval(input())) -data = [int(i) for i in input().split()] -for i in range(n): -    v = data[i] -    j = i - 1 -    while j >= 0 and data[j] > v: -        data[j + 1] = data[j] -        j -= 1 -    data[j + 1] = v -    print((*data)) +def InsertionSort(A, N): +    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(a) for a in input().split()] +InsertionSort(A, N)