require 'scanf'
while true 
    h,w,d=STDIN.gets.scanf("%d %d %d")
    exit if h==0 and w==0 and d==0
    d2_min=[h*h+w*w,w*w+d*d,d*d+h*h].min
    n=STDIN.gets.to_i
    for i in 0..n-1 do
        r=STDIN.gets.to_i
        print "OK\n" if 4*r*r>d2_min
        print "NA\n" if 4*r*r<=d2_min
    end
end