n = STDIN.gets.to_i
list = STDIN.gets.split.map(&:to_i)
puts list.join(" ")
(1...n).each do |i|
  v = list[i]
  j = i - 1
  while j >= 0 && list[j] > v
    list[j+1] = list[j]
    j -= 1
    list[j+1] = v
  end
  puts list.join(" ")
end

