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

until (arr = gets.split.map(&:to_i)) == [0, 0, 0]
  tmp = cheese(*arr.sort.first(2))
  
  gets.to_i.times do
    puts tmp < gets.to_i ? "OK" : "NA"
  end
end