def sort_print (arr)
  i = 1
  while i < arr.size
    key = arr[i]
    j = i - 1
    while  j >= 0 and arr[j] > key
      arr[j+1] = arr[j]
      j = j - 1
    end
    arr[j+1] = key
    i = i + 1
    puts arr.join(' ')
  end
end

arr = []
size = gets.chomp.to_i
arr = gets.chomp.split(' ').each{|x| x.to_i}

sort_print(arr)