Nigeria and Egypt were drawn together and so were Cameroon and South Africa in the highlights of the 2017 Africa Cup of Nations qualifying draw made Wednesday in Cairo.
The Nigerians and Egyptians are in Group G with Tanzania and Chad, and the Cameroonians and South Africans in Group M with Gambia and Mauritania.
Egypt have won the biennial Cup of Nations tournament a record seven times, Cameroon four times, Nigeria three times and South Africa once.
Only the 13 group winners are guaranteed places at the January-February 2017 tournament in Gabon with just the best two runners-up also going through.
Nigeria and Egypt are more accustomed to playing at the finals, but a dramatic fall from power by the Pharaohs meant they were only among the second seeds.
After winning three consecutive titles in 2006, 2008 and 2010, Egypt failed to qualify for the next three tournaments.
The Arab Spring political upheaval in Egypt and related security problems severely affected domestic football with many matches cancelled and other fixtures played held in spectator-less stadiums.
Retirements of stars like midfielders Mohamed Abou Trika and Mohamed Barakat and defender Wael Gomaa and the ageing of goalkeeper Essam El-Hadary also diluted the power of the Pharaohs.
The countries last clashed competitively at the 2010 Cup of Nations with Egypt winning a group game 3-1 in Angola.
South Africa were also second seeds, and are a far lesser force than in 1996 when they trounced Cameroon 3-0 in the opening match en route to conquering Africa.
Defending champions Ivory Coast face Sudan and Sierra Leone in Group I, which also includes Gabon.
However, matches against automatic qualifiers Gabon count as friendlies with no points awarded.
Ivory Coast lifted a trophy that symbolises African national-team supremacy for the second time two months ago by edging Ghana 9-8 in a penalty shootout.
The all-west Africa final in Equatorial Guinea city Bata had ended goalless after extra time.
Ghana, who won the last of four Cup of Nations titles 33 years ago, are in Group H with Mozambique, Rwanda and Mauritius.
Morocco were originally barred from the 2017 qualifiers after refusing to host the tournament this year because they feared supporters could bring the deadly Ebola virus into the country.
But the north African kingdom successfully appealed against the ban to the Switzerland-based Court of Arbitration for Sport (CAS).
The Moroccans were placed in Group F with the Cape Verde Islands, Libya and Sao Tome e Principe.
Tunisia were another country whose participation was in doubt after accusing African governing body CAF of bias following a controversial 2015 Cup of Nations quarterfinals loss to hosts Equatorial Guinea.
They eventually apologised to CAF president Issa Hayatou and are in Group A with Togo, Liberia and Djibouti.
Zambia, shock winners of the 2012 title when co-hosts Gabon staged the final in Libreville, face Congo Brazzaville, Kenya and Guinea Bissau in Group E.
Qualifying begins in June.
Afcon 2017 FULL DRAW
Group A: Tunisia, Togo, Liberia, Djibouti
Group B: Madagascar, DRC, Angola, CAR
Group C: Mali, Equatorial Guinea, Benin, South Sudan
Group D: Burkina Faso, Uganda, Botswana, Comoros
Group E: Zambia, Congo, Kenya, Guinea Bissau
Group F: Cape Verde, Morocco, Libya, Sao Tome
Group G: Nigeria, Egypt, Tanzania, Chad
Group H: Ghana, Mozambique, Rwanda, Mauritius
Group I: Ivory Coast, Sudan, Sierra Leone, Gabon
Group J: Algeria, Ethiopia, Lesotho, Seychelles
Group K: Senegal, Niger, Nambia, Burundi
Group L: Guinea, Malawi, Zimbabwe, Swaziland
Group M: Cameroon, South Africa, Gambia, Mauritania