Rwanda have qualified for the quarter-finals of the African Nations Championship after coming from behind to beat Togo in a crunch Group C clash in Cameroon.