def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = list(A)
    print(*a, sep=' ')
    insertionSort(a, N)

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
        print(*a, sep=' ')

main() def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = list(A)
    print(*a, sep=' ')
    insertionSort(a, N) main N = int(input()) N int(input()) int input() input A = tuple(map(int, input().split())) A tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split a = list(A) a list(A) list A print(*a, sep=' ') print *a a sep=' ' sep ' ' insertionSort(a, N) insertionSort a N 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
        print(*a, sep=' ') 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
        print(*a, sep=' ') 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 print(*a, sep=' ') print *a a sep=' ' sep ' ' a a n n main() main def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = list(A)
    print(*a, sep=' ')
    insertionSort(a, N) def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = list(A)
    print(*a, sep=' ')
    insertionSort(a, N) main 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
        print(*a, sep=' ') 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
        print(*a, sep=' ') insertionSort
def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = list(A)
    print(*a, sep=' ')
    insertionSort(a, N)

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
        print(*a, sep=' ')

main()