def insertionSort(A, N):
    for i in range(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
        B = A.copy()
        for t in range(N):
            B[t] = str(B[t])
        print(" ".join(B))


n = int(input())
a = list(map(int, input().split()))
insertionSort(a, n) def insertionSort(A, N):
    for i in range(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
        B = A.copy()
        for t in range(N):
            B[t] = str(B[t])
        print(" ".join(B)) insertionSort for i in range(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
        B = A.copy()
        for t in range(N):
            B[t] = str(B[t])
        print(" ".join(B)) i range(N) range 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 B = A.copy() B A.copy() A.copy A copy for t in range(N):
            B[t] = str(B[t])
         t range(N) range N B[t] = str(B[t]) B[t] B t str(B[t]) str B[t] B t print(" ".join(B)) print " ".join(B) " ".join " " join B A A N N 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 insertionSort(a, n) insertionSort a n n = int(input()) int(input()) n a = list(map(int, input().split())) list(map(int, input().split())) a def insertionSort(A, N):
    for i in range(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
        B = A.copy()
        for t in range(N):
            B[t] = str(B[t])
        print(" ".join(B)) def insertionSort(A, N):
    for i in range(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
        B = A.copy()
        for t in range(N):
            B[t] = str(B[t])
        print(" ".join(B)) insertionSort
def insertionSort(A, N):
    for i in range(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
        B = A.copy()
        for t in range(N):
            B[t] = str(B[t])
        print(" ".join(B))


n = int(input())
a = list(map(int, input().split()))
insertionSort(a, n)
