counts = 1
size = 0
array = []
  
def print_array(array)
  str = ""
  array.each{|s|
   str = str + "\s" + s.to_s
  }
 puts  str.strip!
end
  
loop{
  if counts == 1 then
    size = gets.to_i
   else
     array = gets.split("\s")
   end
  
   counts = counts + 1
   
  if counts > 2 then
    break
   end
}
  
 
for i in 1..size - 1  do
  print_array(array)
  
  v = array[i].to_i
  j = i - 1
  
  while (j >= 0 && array[j].to_i > v ) do
    array[j+1] = array[j]
    j = j - 1
  end
  
  array[j+1] = v
  
end
  
print_array(array)