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(input())
    input_array = list(map(int, input().split()))

    insertion_sort(input_array)

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))) insertion_sort '''?????????????´?????????????????????¨??????????????????????????¨???????????????????????§?????\?????????????????°????????????
    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))) i range(len(array)) range len(array) len array v = array[i] v array[i] array i j = i - 1 j i - 1 i 1 while(j>=0 and array[j] > v):
            array[j+1] = array[j]
            j = j - 1

         j>=0 and array[j] > v j>=0 j 0 array[j] > v array[j] array j v array[j+1] = array[j] array[j+1] array j+1 j 1 array[j] array j j = j - 1 j j - 1 j 1 array[j+1] = v array[j+1] array j+1 j 1 v print(' '.join(map(str, array))) print ' '.join(map(str, array)) ' '.join ' ' join map(str, array) map str array array 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(input())
    input_array = list(map(int, input().split()))

    insertion_sort(input_array) 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(input()) element_number int(input()) int input() input input_array = list(map(int, input().split())) input_array list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split insertion_sort(input_array) insertion_sort input_array if __name__ == '__main__':
    test() __name__ == '__main__' __name__ '__main__' test() test 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(input())
    input_array = list(map(int, input().split()))

    insertion_sort(input_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(input())
    input_array = list(map(int, input().split()))

    insertion_sort(input_array) 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 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))) insertion_sort
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(input())
    input_array = list(map(int, input().split()))

    insertion_sort(input_array)

if __name__ == '__main__':
    test()