x = gets
y = x.split(" ")
d = y[0].to_i
w = y[1].to_i
h = y[2].to_i
until d == 0 && w == 0 && h == 0
    s = (d * d) + (h * h)
    rr = s**(1/2.0)
    rr1 = rr / 2
    s = (d * d) + (w * w)
    rr = s**(1/2.0)
    rr2 = rr / 2
    s = (w * w) + (h * h)
    rr = s**(1/2.0)
    rr3 = rr / 2 
n = gets.to_i
n.times do
    r = gets.to_i
    if r > rr1
        puts "OK"
    elsif r > rr2
        puts "OK"
    elsif r > rr3
        puts "OK"
    else
        puts "NA"
    end
end

x = gets
y = x.split(" ")
d = y[0].to_i
w = y[1].to_i
h = y[2].to_i
end
