n = gets
as = gets.split(" ").map(&:to_i)
prev = nil
as.length.times do |i|
  key = as[i]
  j = i - 1
  while j >= 0 && as[j] > key
    as[j+1] = as[j]
    j -= 1
  end
  as[j+1] = key
  puts as.join(" ")
end