N = gets.to_i
seqence = gets.chomp.split().map { |e| e.to_i }

for i in 1..(N-1)
  key = seqence[i]
  j = i - 1

  while j >= 0 && seqence[j] > key
    seqence[j+1] = seqence[j]
    j -= 1
  end
  seqence[j+1] = key
  puts seqence.join(" ")
end