r=Array.new
cheese=Array.new
50.times{
r=Array.new
cheese=Array.new
	cheese = gets.chomp.split(" ").map{|i| i.to_i}
	cheese.sort!
	min=cheese[0]**2 +cheese[1]**2
	
	if cheese[0]==0 && cheese[1] == 0 && cheese[2] ==0
		break
	end
	n = gets.chomp.to_i
	n.times{
	r << gets.to_i
	



	
	}
	r.each{|i|
		if (i*2)**2 > min
			puts "OK"
		else
			puts "NA"
		end
	}
}