d_w_h = gets.split.map(&:to_i)
combination = d_w_h.combination(2)
gets

while line = gets
  break if line.chomp == '0 0 0'

  d = line.to_i * 2
  can_pass = combination.any? { |x, y|
    x < d && y < d && Math.sqrt(x**2 + y**2) < d
  }

  puts can_pass ? 'OK' : 'NA'
end