function m_otimo = WhoGivesMaxUtility(n, C, Pn, Pm, Gnb, Gmb, Gnn, Gmn, Im, Wm, sigma2_m, sigma2_n)
    max_util = -1;
    m_otimo = 0;
    for i=1:length(C)
        m = C(i);
        if (Pn(n)*Gnb(n))<=Im(m)
            u = Wm(m)*log2(1 + (Pm(m)*Gmb(m))/(sigma2_m(m) + Pn(n)*Gnb(n)))+...
                Wm(m)*log2(1 + (Pn(n)*Gnn(n))/(sigma2_n(n) + Pm(m)*Gmn(m,n)));
            if u>max_util
                max_util = u;
                m_otimo = m;
            end
        end
    end

end