def insertionSort(array, amount):
    for i in range(1, amount):
        v = array[i]
        j = i - 1
        while j >= 0 and array[j] > v:
            array[j + 1] = array[j]
            j = j - 1

        array[j + 1] = v

        for i in range(amount - 1):
            print(array[i], end=" ")
        print(array[amount - 1])

amount = int(input())
array = [0 for i in range(amount)]
array = list(map(int, input().split()))

for i in range(amount - 1):
    print(array[i], end=" ")
print(array[amount - 1])

insertionSort(array, amount) def insertionSort(array, amount):
    for i in range(1, amount):
        v = array[i]
        j = i - 1
        while j >= 0 and array[j] > v:
            array[j + 1] = array[j]
            j = j - 1

        array[j + 1] = v

        for i in range(amount - 1):
            print(array[i], end=" ")
        print(array[amount - 1]) insertionSort for i in range(1, amount):
        v = array[i]
        j = i - 1
        while j >= 0 and array[j] > v:
            array[j + 1] = array[j]
            j = j - 1

        array[j + 1] = v

        for i in range(amount - 1):
            print(array[i], end=" ")
        print(array[amount - 1]) i range(1, amount) range 1 amount v = array[i] v array[i] array i j = i - 1 j i - 1 i 1 while j >= 0 and array[j] > v:
            array[j + 1] = array[j]
            j = j - 1

         j >= 0 and array[j] > v j >= 0 j 0 array[j] > v array[j] array j v array[j + 1] = array[j] array[j + 1] array j + 1 j 1 array[j] array j j = j - 1 j j - 1 j 1 array[j + 1] = v array[j + 1] array j + 1 j 1 v for i in range(amount - 1):
            print(array[i], end=" ")
         i range(amount - 1) range amount - 1 amount 1 print(array[i], end=" ") print array[i] array i end=" " end " " print(array[amount - 1]) print array[amount - 1] array amount - 1 amount 1 array array amount amount amount = int(input()) amount int(input()) int input() input 0 for i in range(amount) for i in range(amount) i range(amount) range amount for i in range(amount) 0 array = [0 for i in range(amount)] array [0 for i in range(amount)] array = list(map(int, input().split())) array list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for i in range(amount - 1):
    print(array[i], end=" ") i range(amount - 1) range amount - 1 amount 1 print(array[i], end=" ") print array[i] array i end=" " end " " print(array[amount - 1]) print array[amount - 1] array amount - 1 amount 1 insertionSort(array, amount) insertionSort array amount amount = int(input()) int(input()) amount array = [0 for i in range(amount)] [0 for i in range(amount)] array def insertionSort(array, amount):
    for i in range(1, amount):
        v = array[i]
        j = i - 1
        while j >= 0 and array[j] > v:
            array[j + 1] = array[j]
            j = j - 1

        array[j + 1] = v

        for i in range(amount - 1):
            print(array[i], end=" ")
        print(array[amount - 1]) def insertionSort(array, amount):
    for i in range(1, amount):
        v = array[i]
        j = i - 1
        while j >= 0 and array[j] > v:
            array[j + 1] = array[j]
            j = j - 1

        array[j + 1] = v

        for i in range(amount - 1):
            print(array[i], end=" ")
        print(array[amount - 1]) insertionSort array = list(map(int, input().split())) list(map(int, input().split())) array
def insertionSort(array, amount):
    for i in range(1, amount):
        v = array[i]
        j = i - 1
        while j >= 0 and array[j] > v:
            array[j + 1] = array[j]
            j = j - 1

        array[j + 1] = v

        for i in range(amount - 1):
            print(array[i], end=" ")
        print(array[amount - 1])

amount = int(input())
array = [0 for i in range(amount)]
array = list(map(int, input().split()))

for i in range(amount - 1):
    print(array[i], end=" ")
print(array[amount - 1])

insertionSort(array, amount)