def showList(A, N):
    for i in range(N-1):
        print(A[i],end=' ')
    print(A[N-1])

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


N = int(input())
A = [int(x) for x in input().split(' ')]

A = insertionSort(A, N) def showList(A, N):
    for i in range(N-1):
        print(A[i],end=' ')
    print(A[N-1]) showList for i in range(N-1):
        print(A[i],end=' ')
     i range(N-1) range N-1 N 1 print(A[i],end=' ') print A[i] A i end=' ' end ' ' print(A[N-1]) print A[N-1] A N-1 N 1 A A N N def insertionSort(A, N):
    showList(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
        showList(A,N) insertionSort showList(A,N) showList 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
        showList(A,N) 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 showList(A,N) showList A N A A N N N = int(input()) N int(input()) int input() input int(x) for x in input().split(' ') for x in input().split(' ') x input().split(' ') ().split () input split ' ' for x in input().split(' ') int(x) int x A = [int(x) for x in input().split(' ')] A [int(x) for x in input().split(' ')] A = insertionSort(A, N) A insertionSort(A, N) insertionSort A N def insertionSort(A, N):
    showList(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
        showList(A,N) def insertionSort(A, N):
    showList(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
        showList(A,N) insertionSort A = insertionSort(A, N) insertionSort(A, N) A def showList(A, N):
    for i in range(N-1):
        print(A[i],end=' ')
    print(A[N-1]) def showList(A, N):
    for i in range(N-1):
        print(A[i],end=' ')
    print(A[N-1]) showList A = [int(x) for x in input().split(' ')] [int(x) for x in input().split(' ')] A N = int(input()) int(input()) N
def showList(A, N):
    for i in range(N-1):
        print(A[i],end=' ')
    print(A[N-1])

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


N = int(input())
A = [int(x) for x in input().split(' ')]

A = insertionSort(A, N)
