After long negotiations the territorial changes resulting from the conflict were firmly established at the Treaty of Quedlinburg  of 13 May 1523. The main import of these changes were significant gains for the princes of Brunswick-Wolfenbüttel, whilst the Prince-Bishopric of Hildesheim was left with just 4 of its original 22 districts  as well as the towns of Hildesheim and Peine, the so-called Kleines Stift  of some 90 villages. The ecclesiastical boundary of the diocese remained unchanged. The Principality of Brunswick-Wolfenbüttel was awarded the Ämter of Winzenburg, Wohldenberg, Steinbrück, Lutter, Wohlenstein, Schladen, Liebenburg, Wiedelah, Vienenburg and Westerhof with the abbeys of Lamspringe, Heiningen, Dorstadt, Wöltingerode, Ringelheim and Riechenberg, as well as the towns of Alfeld, Bockenem, Lamspringe and Salzgitter. The Principality of Calenberg received the houses, i.e.fortified seats, and Ämter of Hunnesrück with Markoldendorf, Aerzen, Lauenstein, Grohnde, Hallerburg, Poppenburg, Ruthe and Coldingen, the towns of Dassel, Bodenwerder, Gronau, Elze, Sarstedt, half of  Hameln and the abbeys of Marienau, Escherde, Wittenburg, Wülfinghausen and Derneburg. Hildesheim immediately began a legal fight for the return of its Großes Stift . This finally ended in 1643 in the Main Treaty of Hildesheim  with a revision of the Treaty of Quedlinburg and return of most of the territories. Exceptions were the Ämter of Aerzen, Grohnde, Coldingen-Lauenberg, Lutter am Barenberge, Westerhof and Lindau, which remained with the principalities of Calenberg and Brunswick-Wolfenbüttel. Prince-bishop John IV gave up the prince-bishopric in 1527 and later became canon of Ratzeburg and died in 1547 in Lübeck.
Question: What treaty was signed first: Treaty of Quedlinburg or Main Treaty of Hildesheim?
Answer: Treaty of Quedlinburg