n = int(input())

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



def pri(lst):

    for i in range(len(lst)-1):

        print(lst[i],end=" ")

    print(lst[-1])



pri(lst)

for i in range(1,n):

    v = lst[i]

    j = i-1

    while True:

        if j < 0:

            lst[0] = v

            break

        if lst[j] > v:

            lst[j+1] = lst[j]

            j -= 1

        else:

            lst[j+1] = v

            break

    pri(lst)



def insertsort(array):

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

        print((" ".join(list(map(str,array)))))

        temp = array[i]

        j = i-1

        while j >= 0 and temp < array[j]:

            array[j+1] = array[j]

            j -= 1

        array[j+1] = temp

    return array



eval(input())

a = insertsort(list(map(int,input().split())))

print((" ".join(list(map(str,a)))))



n = int(input())
lst = list(map(int, input().split()))


def pri(lst):
    for i in range(len(lst) - 1):
        print(lst[i], end=" ")
    print(lst[-1])


pri(lst)
for i in range(1, n):
    v = lst[i]
    j = i - 1
    while True:
        if j < 0:
            lst[0] = v
            break
        if lst[j] > v:
            lst[j + 1] = lst[j]
            j -= 1
        else:
            lst[j + 1] = v
            break
    pri(lst)

def insertsort(array):
    for i in range(1, len(array)):
        print((" ".join(list(map(str, array)))))
        temp = array[i]
        j = i - 1
        while j >= 0 and temp < array[j]:
            array[j + 1] = array[j]
            j -= 1
        array[j + 1] = temp
    return array


eval(input())
a = insertsort(list(map(int, input().split())))
print((" ".join(list(map(str, a)))))

-n = int(input()) -lst = list(map(int, input().split())) +def insertsort(array): +    for i in range(1, len(array)): +        print((" ".join(list(map(str, array))))) +        temp = array[i] +        j = i - 1 +        while j >= 0 and temp < array[j]: +            array[j + 1] = array[j] +            j -= 1 +        array[j + 1] = temp +    return array -def pri(lst): -    for i in range(len(lst) - 1): -        print(lst[i], end=" ") -    print(lst[-1]) - - -pri(lst) -for i in range(1, n): -    v = lst[i] -    j = i - 1 -    while True: -        if j < 0: -            lst[0] = v -            break -        if lst[j] > v: -            lst[j + 1] = lst[j] -            j -= 1 -        else: -            lst[j + 1] = v -            break -    pri(lst) +eval(input()) +a = insertsort(list(map(int, input().split()))) +print((" ".join(list(map(str, a)))))