n = int(eval(input()))

data = list(map(int, input().split()))



def insertion_sort(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))



insertion_sort(data, n)
n = int(eval(input()))

data = list(map(int, input().split()))



def insertionsort(a, n):

    for i in range(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))



insertionsort(data, n)
n = int(eval(input()))
data = list(map(int, input().split()))


def insertion_sort(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))


insertion_sort(data, n)

n = int(eval(input()))
data = list(map(int, input().split()))


def insertionsort(a, n):
    for i in range(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))


insertionsort(data, n)

-def insertion_sort(A, N): -    print((*A)) -    for i in range(1, N): -        v = A[i] +def insertionsort(a, n): +    for i in range(n): +        v = a[i] -        while j >= 0 and A[j] > v: -            A[j + 1] = A[j] +        while j >= 0 and a[j] > v: +            a[j + 1] = a[j] -        A[j + 1] = v -        print((*A)) +        a[j + 1] = v +        print((*a)) -insertion_sort(data, n) +insertionsort(data, n)