#!/usr/bin/env ruby

num = gets.chomp
array = gets.chomp.split(" ")
i = 1

while i <= array.length - 1 do
  puts array.join(' ')
  key = array[i]
  # insert A[i] into the sorted sequence A[0, ..., j-1]
  j = i - 1
  while j >= 0 do
    if array[j] > key then
      array[j+1] = array[j]
      array[j] = key
    else
      j = 0
    end
    j -= 1
  end
  i += 1
end
puts array.join(' ')