class Cheese
  class << self
    def run
        cheese = gets.split().map {|x| x.to_i}
        cheese.sort!

        count = gets.chomp!.to_i
        gate_r = Array.new()
        count.times do
          gate_r.push(gets.chomp!.to_i)
        end

        eoi = gets

        gate_r.each do |r|
          if cheese[0] < 2 * r and cheese[1] < 2 * r then
            puts "OK"
          else
            puts "NA"
          end
        end
    end
  end
end

if __FILE__ == $0
  Cheese.run
end