length = gets.to_i
arr = gets.split.map(&:to_i)

def insertion_sort(arr, length)
  for i in 1..(length-1) do
    v = arr[i]
    sub = 0
    while i - 1 - sub >=0 && arr[i - sub -1] > v do
      arr[i - sub] = arr[i - sub - 1]
      sub += 1
    end
    arr[i - sub] = v
    puts arr.join(' ')
  end
end

puts arr.join(' ')
insertion_sort(arr, length)
