def insertion_sort a
  a.each_with_index do |key, i|
    j = i - 1
    while j >= 0 && a[j] > key
      a[j + 1] = a[j]
      j -= 1
    end
    a[j + 1] = key
    puts a.join(' ')
  end
end

n = gets.to_i
a = gets.split.map(&:to_i)

insertion_sort a