# inputList = list(map(int, '''6
# 5 2 4 6 1 3'''.split()))
# N = inputList.pop(0)


def formatting(nums):
    for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i])


def insertionSort(A, N):
    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
        formatting(A)


N = int(input())
inputList = list(map(int, input().split()))

formatting(inputList)
insertionSort(inputList, N)
 def formatting(nums):
    for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i]) formatting for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i]) i range(len(nums)) range len(nums) len nums if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i]) i != len(nums) - 1 i len(nums) - 1 len(nums) len nums 1 print(nums[i], end=' ') print nums[i] nums i end=' ' end ' ' print(nums[i]) print nums[i] nums i nums nums def insertionSort(A, N):
    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
        formatting(A) insertionSort 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
        formatting(A) i range(1, N) range 1 N v = A[i] v A[i] A i j = i - 1 j i - 1 i 1 while j >= 0 and A[j] > v:
            A[j+1] = A[j]

            j-=1
         j >= 0 and A[j] > v j >= 0 j 0 A[j] > v A[j] A j v A[j+1] = A[j] A[j+1] A j+1 j 1 A[j] A j j-=1 j 1 A[j+1] = v A[j+1] A j+1 j 1 v formatting(A) formatting A A A N N N = int(input()) N int(input()) int input() input inputList = list(map(int, input().split())) inputList list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split formatting(inputList) formatting inputList insertionSort(inputList, N) insertionSort inputList N N = int(input()) int(input()) N def formatting(nums):
    for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i]) def formatting(nums):
    for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i]) formatting def insertionSort(A, N):
    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
        formatting(A) def insertionSort(A, N):
    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
        formatting(A) insertionSort inputList = list(map(int, input().split())) list(map(int, input().split())) inputList
# inputList = list(map(int, '''6
# 5 2 4 6 1 3'''.split()))
# N = inputList.pop(0)


def formatting(nums):
    for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i])


def insertionSort(A, N):
    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
        formatting(A)


N = int(input())
inputList = list(map(int, input().split()))

formatting(inputList)
insertionSort(inputList, N)

