Ergodic Maximum Principle for Stochastic Systems