while true
    a, b = gets.chomp.split.map(&:to_i)
    break if [a, b] == [0, 0]
    arr = []
    amount = b - a
    arr[2], amount = amount.divmod(1000)
    arr[1], amount = amount.divmod(500)
    arr[0] = amount / 100
    puts arr.join(" ")
end
