class Cheese

  def initialize(f)
    @u,@v,@w = f.sort
    @x = Math.sqrt(@u**2+@v**2)
  end

  def thru(r)
    return (2*r > @x) ? "OK" : "NA"
  end

end

def main
  if true then
    fh=STDIN
  else
    fh=open("in1_0107.txt")
  end

  u,v,w = fh.gets.chomp.split.map{|x| x.to_i}
  n = fh.gets.chomp.to_i
  rad = []
  0.upto(n-1){|i|
    rad[i] = fh.gets.chomp.to_i
  }

  ch = Cheese.new([u,v,w])

  0.upto(n-1){|i|
    puts ch.thru(rad[i])
  }
end

if $0 == __FILE__ then
  main
end