The group stage of the African Cup of Nations football finals ended with two matches Wednesday.

Morocco and Nigeria completed the list of teams to advance to the quarterfinal of the 24th African Cup of Nations. Morocco finished at the top of Group D, after a 1-1 tie to eliminate South Africa.

Morrocco will play Algeria in the quarterfinals. Nigeria will play Cameroon, which is hoping to win its third cup in a row.

Cameroon emerged at the top of Group C, after being held to a goal-less draw Tuesday by Egypt. The Egyptians are homeward-bound, despite finishing with the same points as Algeria. The Algerians qualified due to a superior goal difference.

Host Tunisia will play Senegal, while Mali will play Guinea. A late equalizer Monday against the Tunisians ensured Guinea a place in the quarterfinals.

Kenya won its first game in 32 years, when it beat Burkina Faso in its last game. Prior to this historic win, Kenya had made the finals five times, losing nine and drawing four games.

Egypt, rated second after Cameroon in Africa, is the biggest casualty of the group stage, while the Democratic Republic of the Congo and first-time finalist Benin are the only teams to go home without a point after losing all three of their group matches.

The tournament, which kicked off on January 24 with 16 teams, runs through February 14. The quarterfinals will be played Saturday and Sunday.