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

  while fh.gets do
    u,v,w = $_.chomp.split.map{|x| x.to_i}
    break if u==0 and v==0 and w==0
    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
end

main
if $0 == __FILE__ then
end