while line = gets do
    x=Array.new(3) { |i|  }
    x[0],x[1],x[2] = line.split.map(&:to_i)
    if x[0]+x[1]+x[2]==0 then
        break
    end
    x=x.sort
    w=Math.sqrt(x[0]**2+x[1]**2)
    #puts w

    gets.to_i.times do
        a = gets.to_i
        if a*2>w then
            puts 'OK'
        else
            puts 'NA'
        end
    end
end