# Aizu Problem ALDS_1_1_A: Insertion Sort
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input2.txt", "rt")


def printA(A):
    print(' '.join([str(a) for a in A]))

def insertion_sort(A):
    for i in range(1, len(A)):
        key = A[i]
        # insert A[i] into the sorted sequence A[0,...,j-1] 
        j = i - 1
        while j >= 0 and A[j] > key:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = key
        printA(A)

        
N = int(input())
A = [int(_) for _ in input().split()]
printA(A)
insertion_sort(A) import sys, math, os sys math os PYDEV = os.environ.get('PYDEV') PYDEV os.environ.get('PYDEV') os.environ.get os.environ os environ get 'PYDEV' if PYDEV=="True":
    sys.stdin = open("sample-input2.txt", "rt") PYDEV=="True" PYDEV "True" sys.stdin = open("sample-input2.txt", "rt") sys.stdin sys stdin open("sample-input2.txt", "rt") open "sample-input2.txt" "rt" def printA(A):
    print(' '.join([str(a) for a in A])) printA str(a) for a in A for a in A a A for a in A str(a) str a print(' '.join([str(a) for a in A])) print ' '.join([str(a) for a in A]) ' '.join ' ' join [str(a) for a in A] A A def insertion_sort(A):
    for i in range(1, len(A)):
        key = A[i]
        # insert A[i] into the sorted sequence A[0,...,j-1] 
        j = i - 1
        while j >= 0 and A[j] > key:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = key
        printA(A)

         insertion_sort for i in range(1, len(A)):
        key = A[i]
        # insert A[i] into the sorted sequence A[0,...,j-1] 
        j = i - 1
        while j >= 0 and A[j] > key:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = key
        printA(A)

         i range(1, len(A)) range 1 len(A) len A key = A[i] key A[i] A i j = i - 1 j i - 1 i 1 while j >= 0 and A[j] > key:
            A[j+1] = A[j]
            j -= 1
         j >= 0 and A[j] > key j >= 0 j 0 A[j] > key A[j] A j key A[j+1] = A[j] A[j+1] A j+1 j 1 A[j] A j j -= 1 j 1 A[j+1] = key A[j+1] A j+1 j 1 key printA(A) printA A A A N = int(input()) N int(input()) int input() input int(_) for _ in input().split() for _ in input().split() _ input().split() ().split () input split for _ in input().split() int(_) int _ A = [int(_) for _ in input().split()] A [int(_) for _ in input().split()] printA(A) printA A insertion_sort(A) insertion_sort A PYDEV = os.environ.get('PYDEV') os.environ.get('PYDEV') PYDEV A = [int(_) for _ in input().split()] [int(_) for _ in input().split()] A def printA(A):
    print(' '.join([str(a) for a in A])) def printA(A):
    print(' '.join([str(a) for a in A])) printA N = int(input()) int(input()) N def insertion_sort(A):
    for i in range(1, len(A)):
        key = A[i]
        # insert A[i] into the sorted sequence A[0,...,j-1] 
        j = i - 1
        while j >= 0 and A[j] > key:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = key
        printA(A)

         def insertion_sort(A):
    for i in range(1, len(A)):
        key = A[i]
        # insert A[i] into the sorted sequence A[0,...,j-1] 
        j = i - 1
        while j >= 0 and A[j] > key:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = key
        printA(A)

         insertion_sort
# Aizu Problem ALDS_1_1_A: Insertion Sort
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input2.txt", "rt")


def printA(A):
    print(' '.join([str(a) for a in A]))

def insertion_sort(A):
    for i in range(1, len(A)):
        key = A[i]
        # insert A[i] into the sorted sequence A[0,...,j-1] 
        j = i - 1
        while j >= 0 and A[j] > key:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = key
        printA(A)

        
N = int(input())
A = [int(_) for _ in input().split()]
printA(A)
insertion_sort(A)