def main(input = STDIN)
  while (cheese = input.gets.split(" ").map(&:to_i)) != [0, 0, 0]
    r = (cheese.sort[0] ** 2 + cheese.sort[1] ** 2) ** 0.5 / 2
    input.gets.to_i.times do
      if r < input.gets.to_i
        puts "OK"
      else
        puts "NA"
      end
    end
  end
end
main