#!/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 and array[j] > key do
    array[j+1] = array[j]
    j -= 1
  end
  array[j+1] = key
  i += 1
end
puts array.join(' ')