def main():
    N = int(input())
    A = list(map(int, input().split(' ')))

    insertion_sort(A, N)

def insertion_sort(A, N):
    print(' '.join([str(n) for n in A]))

    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v

        print(' '.join([str(n) for n in A]))

    return A

if __name__ == '__main__':
    main() def main():
    N = int(input())
    A = list(map(int, input().split(' ')))

    insertion_sort(A, N) main N = int(input()) N int(input()) int input() input A = list(map(int, input().split(' '))) A list(map(int, input().split(' '))) list map(int, input().split(' ')) map int input().split(' ') ().split () input split ' ' insertion_sort(A, N) insertion_sort A N def insertion_sort(A, N):
    print(' '.join([str(n) for n in A]))

    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v

        print(' '.join([str(n) for n in A]))

    return A insertion_sort str(n) for n in A for n in A n A for n in A str(n) str n print(' '.join([str(n) for n in A])) print ' '.join([str(n) for n in A]) ' '.join ' ' join [str(n) for n in A] for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v

        print(' '.join([str(n) for n in A]))

     i range(1, N) range 1 N v = A[i] v A[i] A i j = i - 1 j i - 1 i 1 while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
         j >= 0 and A[j] > v j >= 0 j 0 A[j] > v A[j] A j v A[j+1] = A[j] A[j+1] A j+1 j 1 A[j] A j j -= 1 j 1 A[j+1] = v A[j+1] A j+1 j 1 v str(n) for n in A for n in A n A for n in A str(n) str n print(' '.join([str(n) for n in A])) print ' '.join([str(n) for n in A]) ' '.join ' ' join [str(n) for n in A] return A A A A N N if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def insertion_sort(A, N):
    print(' '.join([str(n) for n in A]))

    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v

        print(' '.join([str(n) for n in A]))

    return A def insertion_sort(A, N):
    print(' '.join([str(n) for n in A]))

    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v

        print(' '.join([str(n) for n in A]))

    return A insertion_sort def main():
    N = int(input())
    A = list(map(int, input().split(' ')))

    insertion_sort(A, N) def main():
    N = int(input())
    A = list(map(int, input().split(' ')))

    insertion_sort(A, N) main
def main():
    N = int(input())
    A = list(map(int, input().split(' ')))

    insertion_sort(A, N)

def insertion_sort(A, N):
    print(' '.join([str(n) for n in A]))

    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v

        print(' '.join([str(n) for n in A]))

    return A

if __name__ == '__main__':
    main()