while true
    line = gets.chomp
    break if line == "0"
    q1, b, c1, c2, q2 = line.split.map(&:to_i)
    impossible = true
    [b / c1, q2].min.downto(1){|g1|
        g2 = (b - g1 * c1) / c2
        if g1 + g2 >= q1
            puts "#{g1} #{g2}"
            impossible = false
            break
        end
    }
    puts "NA" if impossible
end

