def printA(x)
   x.each_with_index{|a,i|
     print a
     if i<x.length-1 then print ' '
     else print "\n"
     end
   }
end

n=gets.to_i
A=gets.split(' ').map(&:to_i)
printA(A)
for i in 1..A.length-1 do
    key=A[i]
    j=i-1
    loop{
       if j<0 or A[j]<=key then break end
       A[j+1]=A[j]
       j=j-1
    }
    A[j+1]=key
    printA(A)
end