n = int(input())

arr = list(map(int, input().split(' ')))



p = 1

print(' '.join(map(str, arr)))

while True:

    if p >= len(arr):

        break

    for j in range(0,p):

        if arr[p] < arr[j]:

            arr[p],arr[j] = arr[j],arr[p]

    p += 1

    print(' '.join(map(str, arr)))
def sort(a):

    n = len(a)

    for i in range(1,n):

        for j in range(i):

            p = i-j

            if a[p] < a[p-1]:

                a[p], a[p-1] = a[p-1], a[p]

        print(' '.join(map(str, a)))



n = int(input())

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

print(' '.join(map(str, a)))

sort(a)
n = int(input())
arr = list(map(int, input().split(" ")))
p = 1
print(" ".join(map(str, arr)))
while True:
    if p >= len(arr):
        break
    for j in range(0, p):
        if arr[p] < arr[j]:
            arr[p], arr[j] = arr[j], arr[p]
    p += 1
    print(" ".join(map(str, arr)))

def sort(a):
    n = len(a)
    for i in range(1, n):
        for j in range(i):
            p = i - j
            if a[p] < a[p - 1]:
                a[p], a[p - 1] = a[p - 1], a[p]
        print(" ".join(map(str, a)))


n = int(input())
a = list(map(int, input().split(" ")))
print(" ".join(map(str, a)))
sort(a)

+def sort(a): +    n = len(a) +    for i in range(1, n): +        for j in range(i): +            p = i - j +            if a[p] < a[p - 1]: +                a[p], a[p - 1] = a[p - 1], a[p] +        print(" ".join(map(str, a))) + + -arr = list(map(int, input().split(" "))) -p = 1 -print(" ".join(map(str, arr))) -while True: -    if p >= len(arr): -        break -    for j in range(0, p): -        if arr[p] < arr[j]: -            arr[p], arr[j] = arr[j], arr[p] -    p += 1 -    print(" ".join(map(str, arr))) +a = list(map(int, input().split(" "))) +print(" ".join(map(str, a))) +sort(a)