def insertion_sort(A):
    n = len(A)
    print(*A)
    for i in range(1, n):
        item = A[i]
        cur_idx = i - 1
        while cur_idx >= 0 and A[cur_idx] > item:
            A[cur_idx], A[cur_idx + 1] = A[cur_idx + 1], A[cur_idx]
            cur_idx -= 1
        print(*A)


if __name__ == "__main__":
    N = int(input())
    A = [int(elem) for elem in input().split()]
    insertion_sort(A)
 def insertion_sort(A):
    n = len(A)
    print(*A)
    for i in range(1, n):
        item = A[i]
        cur_idx = i - 1
        while cur_idx >= 0 and A[cur_idx] > item:
            A[cur_idx], A[cur_idx + 1] = A[cur_idx + 1], A[cur_idx]
            cur_idx -= 1
        print(*A) insertion_sort n = len(A) n len(A) len A print(*A) print *A A for i in range(1, n):
        item = A[i]
        cur_idx = i - 1
        while cur_idx >= 0 and A[cur_idx] > item:
            A[cur_idx], A[cur_idx + 1] = A[cur_idx + 1], A[cur_idx]
            cur_idx -= 1
        print(*A) i range(1, n) range 1 n item = A[i] item A[i] A i cur_idx = i - 1 cur_idx i - 1 i 1 while cur_idx >= 0 and A[cur_idx] > item:
            A[cur_idx], A[cur_idx + 1] = A[cur_idx + 1], A[cur_idx]
            cur_idx -= 1
         cur_idx >= 0 and A[cur_idx] > item cur_idx >= 0 cur_idx 0 A[cur_idx] > item A[cur_idx] A cur_idx item A[cur_idx], A[cur_idx + 1] = A[cur_idx + 1], A[cur_idx] A[cur_idx] A cur_idx A[cur_idx + 1] A cur_idx + 1 cur_idx 1 A[cur_idx + 1] A cur_idx + 1 cur_idx 1 A[cur_idx] A cur_idx cur_idx -= 1 cur_idx 1 print(*A) print *A A A A if __name__ == "__main__":
    N = int(input())
    A = [int(elem) for elem in input().split()]
    insertion_sort(A) __name__ == "__main__" __name__ "__main__" N = int(input()) N int(input()) int input() input int(elem) for elem in input().split() for elem in input().split() elem input().split() ().split () input split for elem in input().split() int(elem) int elem A = [int(elem) for elem in input().split()] A [int(elem) for elem in input().split()] insertion_sort(A) insertion_sort A A = [int(elem) for elem in input().split()] [int(elem) for elem in input().split()] A N = int(input()) int(input()) N def insertion_sort(A):
    n = len(A)
    print(*A)
    for i in range(1, n):
        item = A[i]
        cur_idx = i - 1
        while cur_idx >= 0 and A[cur_idx] > item:
            A[cur_idx], A[cur_idx + 1] = A[cur_idx + 1], A[cur_idx]
            cur_idx -= 1
        print(*A) def insertion_sort(A):
    n = len(A)
    print(*A)
    for i in range(1, n):
        item = A[i]
        cur_idx = i - 1
        while cur_idx >= 0 and A[cur_idx] > item:
            A[cur_idx], A[cur_idx + 1] = A[cur_idx + 1], A[cur_idx]
            cur_idx -= 1
        print(*A) insertion_sort
def insertion_sort(A):
    n = len(A)
    print(*A)
    for i in range(1, n):
        item = A[i]
        cur_idx = i - 1
        while cur_idx >= 0 and A[cur_idx] > item:
            A[cur_idx], A[cur_idx + 1] = A[cur_idx + 1], A[cur_idx]
            cur_idx -= 1
        print(*A)


if __name__ == "__main__":
    N = int(input())
    A = [int(elem) for elem in input().split()]
    insertion_sort(A)

