until (xyz = gets.split(" ").map(&:to_i)) == [0, 0, 0]
  xy = xyz.combination 2
  gets.to_i.times do
    r = gets.to_i
    puts xy.any? {|(x, y)| (x / 2) ** 2 + (y / 2) ** 2 < r ** 2} ? 'OK' : 'NA'
  end
end