until (size = gets.split.map(&:to_i)).max == 0 do
    min = 99999.9
    0.upto(2) do |i|
        min = [min, Math.sqrt(size[i]**2 + size[(i+1)%3]**2)].min
    end
    gets.to_i.times do
        puts gets.to_i*2 > min ? "OK" : "NA"
    end
end