Original: Saxe-Altenburg thereafter remained part of Saxe-Gotha-Altenburg until the extinction of that house in 1825, when Gotha and Altenburg were split up, with Gotha going to the Duke of Saxe-Coburg-Saalfeld and Altenburg to the Duke of Saxe-Hildburghausen, who in exchange gave up Hildburghausen to the Duke of Saxe-Meiningen.
Simplified: Gotha was given to the Duke of Saxe-Coburg-Saalfeld and Altenburg to the Duke of Saxe-Hildburghausen, who in exchange gave up Saalfeld and Hildburghausen to the Duke of Saxe-Meiningen.