# your code goes here
N=int(input())
A=[int(i) for i in input().split()]
B=""
for k in range(N-1):
    B+=str(A[k])+" "
B+=str(A[N-1])
print(B)
for i in range(1,N):
    j=i-1
    v=A[i]
    while j>=0 and A[j]>v:
        A[j+1]=A[j]
        j-=1
    A[j+1]=v
    B=""
    for k in range(N-1):
        B+=str(A[k])+" "
    B+=str(A[N-1])
    print(B) N=int(input()) N 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()] B="" B "" for k in range(N-1):
    B+=str(A[k])+" " k range(N-1) range N-1 N 1 B+=str(A[k])+" " B str(A[k])+" " str(A[k]) str A[k] A k " " B+=str(A[N-1]) B str(A[N-1]) str A[N-1] A N-1 N 1 print(B) print B for i in range(1,N):
    j=i-1
    v=A[i]
    while j>=0 and A[j]>v:
        A[j+1]=A[j]
        j-=1
    A[j+1]=v
    B=""
    for k in range(N-1):
        B+=str(A[k])+" "
    B+=str(A[N-1])
    print(B) i range(1,N) range 1 N j=i-1 j i-1 i 1 v=A[i] v A[i] A i 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="" B "" for k in range(N-1):
        B+=str(A[k])+" "
     k range(N-1) range N-1 N 1 B+=str(A[k])+" " B str(A[k])+" " str(A[k]) str A[k] A k " " B+=str(A[N-1]) B str(A[N-1]) str A[N-1] A N-1 N 1 print(B) print B N=int(input()) int(input()) N B="" "" B B+=str(A[N-1]) str(A[N-1]) B A=[int(i) for i in input().split()] [int(i) for i in input().split()] A B+=str(A[k])+" " str(A[k])+" " B j=i-1 i-1 j B="" "" B v=A[i] A[i] v B+=str(A[k])+" " str(A[k])+" " B B+=str(A[N-1]) str(A[N-1]) B j-=1 1 j
# your code goes here
N=int(input())
A=[int(i) for i in input().split()]
B=""
for k in range(N-1):
    B+=str(A[k])+" "
B+=str(A[N-1])
print(B)
for i in range(1,N):
    j=i-1
    v=A[i]
    while j>=0 and A[j]>v:
        A[j+1]=A[j]
        j-=1
    A[j+1]=v
    B=""
    for k in range(N-1):
        B+=str(A[k])+" "
    B+=str(A[N-1])
    print(B)