while true 
  abc = STDIN.gets
  abc.chomp!
  if abc == "0 0 0" then break end
  a, b, c = abc.split(" ").map { |item| item.to_i }
  x = Math.sqrt(a*a+b*b)
  y = Math.sqrt(b*b+c*c)
  z = Math.sqrt(a*a+c*c)

  n = STDIN.gets
  n = n.to_i
  n.times do
    r = STDIN.gets
    r = r.to_i * 2
    if r>x or r>y or r>z then
      puts "OK"
    else
      puts "NA"
    end
  end
end