def main
  while nums = gets
    nums = nums.split(/\s/).collect { |x| x.to_i}
    break if nums[0] == 0
    arrs = solve nums
    n = gets.chomp.to_i
    (1..n).each do |ca|
      radius = gets.chomp.to_i
      puts "NA" if arrs.min >= radius
      puts "OK" if arrs.min < radius
    end
  end
end

def solve nums
  ret = []
  nums = nums.collect { |x| x /= 2.0}
  ret << Math.sqrt(nums[0] ** 2 + nums[1] ** 2)
  ret << Math.sqrt(nums[1] ** 2 + nums[2] ** 2)
  ret << Math.sqrt(nums[0] ** 2 + nums[2] ** 2)
  ret
end

main