#coding: utf-8
#AOJ vol1-0106

while input = gets do
  input = input.split.map{|i|i.to_i}
  break if input[0] == 0

  gets.to_i.times.each do
    if gets.to_f > Math.sqrt(input[0]*2 + input[1]*2)
      puts "OK"
    else
      puts "NA"
    end
  end
end