def insertion_sort(array):
    print_array(array)
    for i in range(1,len(array)):
        key = array[i]
        j = i - 1
        while j >= 0 and array[j] > key:
            array[j+1] = array[j]
            j -= 1
        array[j+1] = key
        print_array(array)

def print_array(array):
     print(str(array)[1:-1].replace(', ', ' '))


def main():
    N = int(input())
    array = [int(s) for s in input().split(' ')]
    insertion_sort(array)

if __name__ == '__main__':
    main() def insertion_sort(array):
    print_array(array)
    for i in range(1,len(array)):
        key = array[i]
        j = i - 1
        while j >= 0 and array[j] > key:
            array[j+1] = array[j]
            j -= 1
        array[j+1] = key
        print_array(array) insertion_sort print_array(array) print_array array for i in range(1,len(array)):
        key = array[i]
        j = i - 1
        while j >= 0 and array[j] > key:
            array[j+1] = array[j]
            j -= 1
        array[j+1] = key
        print_array(array) i range(1,len(array)) range 1 len(array) len array key = array[i] key array[i] array i j = i - 1 j i - 1 i 1 while j >= 0 and array[j] > key:
            array[j+1] = array[j]
            j -= 1
         j >= 0 and array[j] > key j >= 0 j 0 array[j] > key array[j] array j key array[j+1] = array[j] array[j+1] array j+1 j 1 array[j] array j j -= 1 j 1 array[j+1] = key array[j+1] array j+1 j 1 key print_array(array) print_array array array array def print_array(array):
     print(str(array)[1:-1].replace(', ', ' ')) print_array print(str(array)[1:-1].replace(', ', ' ')) print str(array)[1:-1].replace(', ', ' ') [1:-1].replace [1:-1] (array) str array 1:-1 1 -1 replace ', ' ' ' array array def main():
    N = int(input())
    array = [int(s) for s in input().split(' ')]
    insertion_sort(array) main N = int(input()) N int(input()) int input() input int(s) for s in input().split(' ') for s in input().split(' ') s input().split(' ') ().split () input split ' ' for s in input().split(' ') int(s) int s array = [int(s) for s in input().split(' ')] array [int(s) for s in input().split(' ')] insertion_sort(array) insertion_sort array if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def print_array(array):
     print(str(array)[1:-1].replace(', ', ' ')) def print_array(array):
     print(str(array)[1:-1].replace(', ', ' ')) print_array def insertion_sort(array):
    print_array(array)
    for i in range(1,len(array)):
        key = array[i]
        j = i - 1
        while j >= 0 and array[j] > key:
            array[j+1] = array[j]
            j -= 1
        array[j+1] = key
        print_array(array) def insertion_sort(array):
    print_array(array)
    for i in range(1,len(array)):
        key = array[i]
        j = i - 1
        while j >= 0 and array[j] > key:
            array[j+1] = array[j]
            j -= 1
        array[j+1] = key
        print_array(array) insertion_sort def main():
    N = int(input())
    array = [int(s) for s in input().split(' ')]
    insertion_sort(array) def main():
    N = int(input())
    array = [int(s) for s in input().split(' ')]
    insertion_sort(array) main
def insertion_sort(array):
    print_array(array)
    for i in range(1,len(array)):
        key = array[i]
        j = i - 1
        while j >= 0 and array[j] > key:
            array[j+1] = array[j]
            j -= 1
        array[j+1] = key
        print_array(array)

def print_array(array):
     print(str(array)[1:-1].replace(', ', ' '))


def main():
    N = int(input())
    array = [int(s) for s in input().split(' ')]
    insertion_sort(array)

if __name__ == '__main__':
    main()