A Court of Arbitration ruling has overturned the outcome of the Africa Cup of Nations, putting Senegal back on top.