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

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

