def insertion_sort(A, N):
    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 = j-1
        A[j+1] = v

        print(*A)

if __name__ == '__main__':
    N = int(input())
    A = [int(_) for _ in input().split()]

    print(*A)

    insertion_sort(A, N) def insertion_sort(A, N):
    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 = j-1
        A[j+1] = v

        print(*A) insertion_sort 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 = j-1
        A[j+1] = v

        print(*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 = 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 = j-1 j j-1 j 1 A[j+1] = v A[j+1] A j+1 j 1 v print(*A) print *A A A A N N if __name__ == '__main__':
    N = int(input())
    A = [int(_) for _ in input().split()]

    print(*A)

    insertion_sort(A, N) __name__ == '__main__' __name__ '__main__' N = int(input()) N int(input()) int input() input int(_) for _ in input().split() for _ in input().split() _ input().split() ().split () input split for _ in input().split() int(_) int _ A = [int(_) for _ in input().split()] A [int(_) for _ in input().split()] print(*A) print *A A insertion_sort(A, N) insertion_sort A N A = [int(_) for _ in input().split()] [int(_) for _ in input().split()] A def insertion_sort(A, N):
    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 = j-1
        A[j+1] = v

        print(*A) def insertion_sort(A, N):
    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 = j-1
        A[j+1] = v

        print(*A) insertion_sort N = int(input()) int(input()) N
def insertion_sort(A, N):
    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 = j-1
        A[j+1] = v

        print(*A)

if __name__ == '__main__':
    N = int(input())
    A = [int(_) for _ in input().split()]

    print(*A)

    insertion_sort(A, N)