x, y = gets.split.map(&:to_i).sort.take(2)

gets.to_i.times do
  input = gets.split.map(&:to_i)
  break unless input.length == 1

  diameter = input.first * 2
  puts Math.sqrt(x**2 + y**2) < diameter ? 'OK' : 'NA'
end