kazu=int(input())
A=[int(i) for i in input().split()]
# kazu=6
# A=[5,2,4,6,1,3]

j=0
for i in range(kazu - 1):
    print(A[i], end=" ")
print(A[kazu-1])

for i in range(1,kazu):
    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
    for i in range(kazu-1):
        print(A[i],end=" ")
    print(A[kazu-1]) kazu=int(input()) kazu int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i A=[int(i) for i in input().split()] A [int(i) for i in input().split()] j=0 j 0 for i in range(kazu - 1):
    print(A[i], end=" ") i range(kazu - 1) range kazu - 1 kazu 1 print(A[i], end=" ") print A[i] A i end=" " end " " print(A[kazu-1]) print A[kazu-1] A kazu-1 kazu 1 for i in range(1,kazu):
    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
    for i in range(kazu-1):
        print(A[i],end=" ")
    print(A[kazu-1]) i range(1,kazu) range 1 kazu 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
        A[j+1]=v
     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 for i in range(kazu-1):
        print(A[i],end=" ")
     i range(kazu-1) range kazu-1 kazu 1 print(A[i],end=" ") print A[i] A i end=" " end " " print(A[kazu-1]) print A[kazu-1] A kazu-1 kazu 1 v=A[i] A[i] v kazu=int(input()) int(input()) kazu j =j -1 j -1 j j=i-1 i-1 j j=0 0 j A=[int(i) for i in input().split()] [int(i) for i in input().split()] A
kazu=int(input())
A=[int(i) for i in input().split()]
# kazu=6
# A=[5,2,4,6,1,3]

j=0
for i in range(kazu - 1):
    print(A[i], end=" ")
print(A[kazu-1])

for i in range(1,kazu):
    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
    for i in range(kazu-1):
        print(A[i],end=" ")
    print(A[kazu-1])