include Math

while gets
	l, w, h = $_.chomp.split.map(&:to_i)
	break if [l,w,h].all?(&:zero?)
	cheese_size = [l,w,h].combination(2).map{ |x,y| sqrt(x**2 + y**2) }.min
	p cheese_size
	n = gets.to_i
	cheese_ok = Array.new(n,0)
	n.times do |i|
		r = gets.to_i
		entrance_limit = 2*r
		cheese_ok[i] = (cheese_size < entrance_limit ? "OK" : "NA")
	end
	puts cheese_ok
end