import sys


def print_arr(arr):
    ln = ''
    for v in arr:
        ln += str(v) + ' '

    ln = ln.strip()
    print(ln)

def insertion_sort(arr):
    for i in range(1, len(arr)):
        print_arr(arr)
        v = arr[i]
        j = i-1
        while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j -= 1
        arr[j+1] = v

    print_arr(arr)

input0 = sys.stdin.readline()
input_sample = sys.stdin.readline()
# input_sample = "5 2 4 6 1 3"
input = input_sample.split(" ")
input = [int(i) for i in input]
insertion_sort(input) import sys sys def print_arr(arr):
    ln = ''
    for v in arr:
        ln += str(v) + ' '

    ln = ln.strip()
    print(ln) print_arr ln = '' ln '' for v in arr:
        ln += str(v) + ' '

     v arr ln += str(v) + ' ' ln str(v) + ' ' str(v) str v ' ' ln = ln.strip() ln ln.strip() ln.strip ln strip print(ln) print ln arr arr def insertion_sort(arr):
    for i in range(1, len(arr)):
        print_arr(arr)
        v = arr[i]
        j = i-1
        while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j -= 1
        arr[j+1] = v

    print_arr(arr) insertion_sort for i in range(1, len(arr)):
        print_arr(arr)
        v = arr[i]
        j = i-1
        while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j -= 1
        arr[j+1] = v

     i range(1, len(arr)) range 1 len(arr) len arr print_arr(arr) print_arr arr v = arr[i] v arr[i] arr i j = i-1 j i-1 i 1 while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j -= 1
         j >= 0 and arr[j] > v j >= 0 j 0 arr[j] > v arr[j] arr j v arr[j+1] = arr[j] arr[j+1] arr j+1 j 1 arr[j] arr j j -= 1 j 1 arr[j+1] = v arr[j+1] arr j+1 j 1 v print_arr(arr) print_arr arr arr arr input0 = sys.stdin.readline() input0 sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline input_sample = sys.stdin.readline() input_sample sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline input = input_sample.split(" ") input input_sample.split(" ") input_sample.split input_sample split " " int(i) for i in input for i in input i input for i in input int(i) int i input = [int(i) for i in input] input [int(i) for i in input] insertion_sort(input) insertion_sort input input_sample = sys.stdin.readline() sys.stdin.readline() input_sample input0 = sys.stdin.readline() sys.stdin.readline() input0 input = input_sample.split(" ") input_sample.split(" ") input input = [int(i) for i in input] [int(i) for i in input] input def insertion_sort(arr):
    for i in range(1, len(arr)):
        print_arr(arr)
        v = arr[i]
        j = i-1
        while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j -= 1
        arr[j+1] = v

    print_arr(arr) def insertion_sort(arr):
    for i in range(1, len(arr)):
        print_arr(arr)
        v = arr[i]
        j = i-1
        while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j -= 1
        arr[j+1] = v

    print_arr(arr) insertion_sort def print_arr(arr):
    ln = ''
    for v in arr:
        ln += str(v) + ' '

    ln = ln.strip()
    print(ln) def print_arr(arr):
    ln = ''
    for v in arr:
        ln += str(v) + ' '

    ln = ln.strip()
    print(ln) print_arr
import sys


def print_arr(arr):
    ln = ''
    for v in arr:
        ln += str(v) + ' '

    ln = ln.strip()
    print(ln)

def insertion_sort(arr):
    for i in range(1, len(arr)):
        print_arr(arr)
        v = arr[i]
        j = i-1
        while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j -= 1
        arr[j+1] = v

    print_arr(arr)

input0 = sys.stdin.readline()
input_sample = sys.stdin.readline()
# input_sample = "5 2 4 6 1 3"
input = input_sample.split(" ")
input = [int(i) for i in input]
insertion_sort(input)