def q a, b
  return Math.sqrt(a**2 + b**2)
end

while [0,0,0] != (d,w,h=gets.split.map &:to_i)
  gets.to_i.times do
    r = gets.to_i
    if [q(d,w), q(d,h), q(w,h)].min < r*2
      puts "OK"
    else
      puts "NA"
    end
  end
end