def calculate_cheese_diagonal(cheese_size)
  cheese_size_array = cheese_size.split.map(&:to_i)
  cheese_size_array << cheese_size_array.first
  cheese_diagonals = cheese_size_array.each_cons(2).map{ |(a, b)| Math.sqrt((a * a) + (b * b)) }
  cheese_size_array.each_cons(2).map{ |(a, b)| Math.sqrt((a * a) + (b * b)) }.min
end

results = []
while cheese_size = gets.strip
  break if cheese_size == "0 0 0"
  cheese_digonal = calculate_cheese_diagonal(cheese_size)
  
  num_holes = gets.strip.to_i
  
  results += num_holes.times.map do
    hole_radius = gets.strip.to_i * 2
    if hole_radius <= cheese_digonal
      "NA"
    else
      "OK"
    end
  end
end

puts results.join("\n")