n = gets.to_i
s = gets.to_s
A= s.split(" ")

puts A.join(' ')

for i in 1..n-1
      v = A[i].to_i
   j = i  - 1
   while j >= 0 && A[j].to_i > v
	  A[j + 1] = A[j]
	  j -= 1
   end
   
   A[j+1] = v	  
   puts A.join(' ')
end

