n =gets.chomp.to_i
a = gets.chomp.split(" ").map{|u|u.to_i}
a.each do |d|
  print("#{d} ")
end
puts ""
(1..n-1).each do |i|
  v = a[i]
  j = i - 1
  while(j >= 0 and a[j] > v)
    a[j+1] = a[j]
    j -= 1
  end
  a[j+1] = v
  a.each do |d|
    print("#{d} ")
  end
  puts ""
end