 args = []
 while l = $stdin.gets
   args.push(l.strip)
 end
 
n = args[0].to_i
a = args[1].split(nil).map(&:to_i)
puts a.join(' ')
1.upto(n - 1) do |i|
  v = a[i]
  j = i - 1
  while j >= 0 and a[j] > v do
    a[j+1] = a[j]
     j -= 1
  end
  a[j+1] = v
  puts a.join(' ')
end