# -*- coding: utf-8 -*-

import sys
import os



def insertion_sort(A):
    n = len(A)
    for i in range(1, n):
        v = A[i]
        j = i - 1

        # i-1????????§???sort??????
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(*A)

input()
lst = list(map(int, input().split()))
print(*lst)
insertion_sort(lst) import sys sys import os os def insertion_sort(A):
    n = len(A)
    for i in range(1, n):
        v = A[i]
        j = i - 1

        # i-1????????§???sort??????
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(*A) insertion_sort n = len(A) n len(A) len A for i in range(1, n):
        v = A[i]
        j = i - 1

        # i-1????????§???sort??????
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(*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 print(*A) print *A A A A input() input lst = list(map(int, input().split())) lst list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split print(*lst) print *lst lst insertion_sort(lst) insertion_sort lst lst = list(map(int, input().split())) list(map(int, input().split())) lst def insertion_sort(A):
    n = len(A)
    for i in range(1, n):
        v = A[i]
        j = i - 1

        # i-1????????§???sort??????
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(*A) def insertion_sort(A):
    n = len(A)
    for i in range(1, n):
        v = A[i]
        j = i - 1

        # i-1????????§???sort??????
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(*A) insertion_sort
# -*- coding: utf-8 -*-

import sys
import os



def insertion_sort(A):
    n = len(A)
    for i in range(1, n):
        v = A[i]
        j = i - 1

        # i-1????????§???sort??????
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(*A)

input()
lst = list(map(int, input().split()))
print(*lst)
insertion_sort(lst)