input=gets.chomp.to_i
str=gets.chomp
num=str.split

for k in 0..input-1 do
  print "#{num[k]} "
end
print "\n"

for i in 1..input-1 do
  key=num[i].to_i
  j=i-1
  while j>=0 && num[j].to_i>key do
    num[j+1]=num[j].to_i
    j-=1
  end
  num[j+1]=key
  for k in 0..input-1 do
    print "#{num[k]} "
  end
  print "\n"
end