def insertion_sort(arr)
  puts arr.join("\s")
  1.upto(arr.size - 1) do |i|
    v = arr[i]
    j = i - 1
    while j >=0 && arr[j] > v
      arr[j+1] = arr[j]
      j -= 1
    end
    arr[j+1] = v
    puts arr.join("\s")
  end
end

n = gets.chomp.to_i
arr = gets.chomp.split.map(&:to_i)
insertion_sort(arr)