def insertionSort(array, n)
  (1..n-1).each do |i|
    puts array.join(" ")
    v = array[i]
    j = i - 1
    while j >=0 && array[j] > v do
      array[j+1] = array[j]
      j -= 1
    end
    array[j+1] = v
  end
  array
end

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

puts insertionSort(a, n).join(" ")
