def insertionSort(a,n)
 1.upto(n-1){|i|
  v=a[i]
  j = i-1
  while j>=0 && a[j]>v
   a[j+1] = a[j]
   j-=1
   a[j+1] = v
  end
  puts a*' '
 }
end

n = gets.to_i
a = gets.split.map{|num|num.to_i}
puts a*' '
insertionSort a,n