num = gets.to_i
ary = gets.split.map(&:to_i)
 
(num-1).times{ |j| print "#{ary[j]} "}
print "#{ary[-1]}\n"
 
for i in 1..num-1
 
  compared = i - 1
 
  while compared >= 0 && ary[compared] > ary[i]
 
    ary[compared], ary[i] = ary[i], ary[compared]
    i -= 1
    compared -= 1
  end
 
  puts ary.join(" ")
end
