def insertion_sort(array, element_number):

    for i in range(element_number):

        v = array[i]

        j = i - 1



        while(j>=0 and array[j] > v):

            array[j+1] = array[j]

            j = j - 1



        array[j+1] = v



        for k in range(element_number):

            if k < element_number-1:

                print(str(array[k]) + ' ', end='')

            else:

                print(str(array[k]), end='')



        print('\n', end='')



def test():

    element_number = int(input())

    input_array = list(map(int, input().split()))



    insertion_sort(input_array, element_number)



if __name__ == '__main__':

    test()

def insertion_sort(array):

    '''?????????????´?????????????????????¨??????????????????????????¨???????????????????????§?????\?????????????????°????????????

    1. ??????????????¨??????????????????????´?????????????????????? v ????¨?????????????

    2. ????????????????????¨??????????????????v ????????§??????????´??????????????????????????§?????????????

    3. ?????????????????????????????????????????????????´? v???????????\?????????'''



    for i in range(len(array)):

        v = array[i]

        j = i - 1



        while(j>=0 and array[j] > v):

            array[j+1] = array[j]

            j = j - 1



        array[j+1] = v

        print((' '.join(map(str, array))))



def test():

    '''??? input =

    6

    5 2 4 6 1 3

    ->

    5 2 4 6 1 3

    2 5 4 6 1 3

    2 4 5 6 1 3

    2 4 5 6 1 3

    1 2 4 5 6 3

    1 2 3 4 5 6'''

    

    element_number = int(eval(input()))

    input_array = list(map(int, input().split()))



    insertion_sort(input_array)



if __name__ == '__main__':

    test()
def insertion_sort(array, element_number):
    for i in range(element_number):
        v = array[i]
        j = i - 1
        while j >= 0 and array[j] > v:
            array[j + 1] = array[j]
            j = j - 1
        array[j + 1] = v
        for k in range(element_number):
            if k < element_number - 1:
                print(str(array[k]) + " ", end="")
            else:
                print(str(array[k]), end="")
        print("\n", end="")


def test():
    element_number = int(input())
    input_array = list(map(int, input().split()))
    insertion_sort(input_array, element_number)


if __name__ == "__main__":
    test()

def insertion_sort(array):
    """?????????????´?????????????????????¨??????????????????????????¨???????????????????????§?????\?????????????????°????????????
    1. ??????????????¨??????????????????????´?????????????????????? v ????¨?????????????
    2. ????????????????????¨??????????????????v ????????§??????????´??????????????????????????§?????????????
    3. ?????????????????????????????????????????????????´? v???????????\?????????"""
    for i in range(len(array)):
        v = array[i]
        j = i - 1
        while j >= 0 and array[j] > v:
            array[j + 1] = array[j]
            j = j - 1
        array[j + 1] = v
        print((" ".join(map(str, array))))


def test():
    """??? input =
    6
    5 2 4 6 1 3
    ->
    5 2 4 6 1 3
    2 5 4 6 1 3
    2 4 5 6 1 3
    2 4 5 6 1 3
    1 2 4 5 6 3
    1 2 3 4 5 6"""
    element_number = int(eval(input()))
    input_array = list(map(int, input().split()))
    insertion_sort(input_array)


if __name__ == "__main__":
    test()

-def insertion_sort(array, element_number): -    for i in range(element_number): +def insertion_sort(array): +    """?????????????´?????????????????????¨??????????????????????????¨???????????????????????§?????\?????????????????°???????????? +    1. ??????????????¨??????????????????????´?????????????????????? v ????¨????????????? +    2. ????????????????????¨??????????????????v ????????§??????????´??????????????????????????§????????????? +    3. ?????????????????????????????????????????????????´? v???????????\?????????""" +    for i in range(len(array)): -        for k in range(element_number): -            if k < element_number - 1: -                print(str(array[k]) + " ", end="") -            else: -                print(str(array[k]), end="") -        print("\n", end="") +        print((" ".join(map(str, array)))) -    element_number = int(input()) +    """??? input = +    6 +    5 2 4 6 1 3 +    -> +    5 2 4 6 1 3 +    2 5 4 6 1 3 +    2 4 5 6 1 3 +    2 4 5 6 1 3 +    1 2 4 5 6 3 +    1 2 3 4 5 6""" +    element_number = int(eval(input())) -    insertion_sort(input_array, element_number) +    insertion_sort(input_array)