gets
a = gets.split.map(&:to_i)
puts a.join(' ')
(1..(a.size - 1)).each do |i|
  tmp = a[i]
  j = i - 1
  while j >= 0 && a[j] > tmp
    a[j + 1] = a[j]
    j -= 1
  end
  a[j + 1] = tmp
  puts a.join(' ')
end