MODE = "stdiro"
#require 'matrix'
#include Math
line = Array.new

if(defined? MODE)
  line = STDIN.read.split("\n")
else
  tmp = '6
  5 2 4 6 1 3'.split("\n")
  tmp.each{|s|
    line << s.strip
  }
end


n = line[0].to_i
a = line[1].split(" ").map(&:to_i)

puts a.join(" ")
(1..n-1).each do |i|
  v = a[i]
  j = i-1
  while (j>=0)&&(a[j]>v) do
    a[j+1] = a[j]
    j -= 1
  end
  a[j+1] = v
  puts a.join(" ")
end