Like Sweden, John II Casimir was also looking for allies to break the deadlock of the war. On 1 December 1656, he signed an alliance with Ferdinand III of Habsburg in Vienna, essentially a declaration of Ferdinand III's intend to mediate a peace rather than provide military aid, which did not come into effect until Ferdinand's death on 2 April 1657. The treaty was however renewed and amended on 27 May by Ferdinand's successor Leopold I of Habsburg, who agreed in Vienna to provide John II Casimir with 12,000 troops maintained at Polish expense; in return, Leopold received Kraków and Posen in pawn. Receiving the news, Frederick III of Denmark promptly declared war on Sweden, and by June the Austrian army entered the Polish-Lithuanian Commonwealth from the south, immediately stabilizing the situation in southern Poland, while Denmark attacked Swedish Bremen-Verden and turned to Jämtland and Västergötland in July. When Charles X Gustav left the Commonwealth and headed westwards for an anti-Danish counterstrike, the Swedish-Brandenburgian-Transylvanian alliance broke apart. Rákóczi of Transylvania was unable to withstand the combined Austrian and Polish-Lithuanian forces without Swedish support, and after a pursuit into Ukraine he was encircled and forced to capitulate, with the rest of the Transylvanian army defeated by the Tartars. Brandenburg changed sides in return for Polish withdrawal of claims to Ducal Prussia, declaring Frederick William the sole sovereign in the Duchy with the treaties of Wehlau on 19 September and Bromberg on 6 November. In addition, the aforementioned treaties secured Brandenburg the Lands of Lauenburg and Bütow at the border of Brandenburgian Pomerania, while the Bishopric of Ermeland was returned to Poland.

Question: How many years do these events span for?
Answer: 1

Question: About how many months do these events span for?
Answer: 9

Question: What event happened first, Ferdinand's death, or John II Casimir signing an alliance?
Answer: On 1 December 1656, he

Question: What event happened first, Ferdinand's death, or the treaty being renewed and ammended?
Answer: Ferdinand's death on 2

Question: What event happened later, Ferdinand's death or the treaty of Wehlau?
Answer: treaties of Wehlau

Question: How many months were between the treaty of Wehlau and Bromberg?
Answer: 2

Question: What event happened first, the treaty of Wehlau, or the treaty of Bromberg?
Answer: treaties of Wehlau

Question: What event happened later, te treaty of Wehlau or the treaty of Bromberg?
Answer: Bromberg on 6 November.

Question: What event happened first, Ferdinand's death, or the treaty of Wehlau?
Answer: Ferdinand's death on 2

Question: What event happened first, Ferdinand's death or the treaty of Bromberg?
Answer: Ferdinand's death on 2