Question: What city in Latvia was ceded by the treaty that ended the Second Northern War?
Context: The Vyborg Governorate was a Russian Governorate 1744-1812, which was established in territories ceded by the Swedish Empire in the Great Northern War.  By the Treaty of Nystad in 1721, Sweden formally ceded control of the parts of the Viborg and Nyslott County and the Kexholm County located on the Karelian Isthmus and Lake Ladoga area to Russia.  First these areas were part of the Saint Petersburg Governorate.  Vyborg Governorate was established in 1744 when Sweden ceded control of parts of Kymmenegård and Nyslott County by the Treaty of Åbo.  In Sweden and Finland the governorate was also known as Old Finland (Swedish: "Gamla Finland" , Finnish: "Vanha Suomi" ), and between 1802 and 1812 it was named the "Finland Governorate". Truce/Treaty of Vilna or Truce/Treaty of Niemieża (Polish: "Rozejm w Niemieży" ) was a treaty signed at Niemieża (modern Nemėžis) near Vilnius (also known as Vilna) on 3 November 1656 between Tsardom of Russia and Polish–Lithuanian Commonwealth, introducing a truce during the Russo-Polish War (1654–67) and an anti-Swedish alliance in the contemporaneous Second Northern War.  In return for ceasing hostilities and fighting Sweden alongside Poland–Lithuania, the treaty promised Alexis of Russia succession in Poland after John II Casimir Vasa's death.  The cossacks under Bohdan Khmelnytsky were excluded from the negotiations, and subsequently supported the Transylvanian invasion on the Swedish side. The Treaty of Roskilde was concluded on 26 February (OS) or 8 March 1658 (NS) during the Second Northern War between Frederick III of Denmark–Norway and Charles X Gustav of Sweden in the Danish city of Roskilde.  After a devastating defeat, Denmark-Norway was forced to give up a third of its territory to save the rest, the ceded lands comprising Blekinge, Bornholm, Bohuslän (Båhuslen), Scania (Skåne) and Trøndelag, as well as her claims to Halland. Joachim Gersdorff (12 November 1611 - 19 April 1661) was a Danish politician, from 1650 to 1660 Steward of the Danish Realm.  It was Gersdorff who negotiated the Treaty of Roskilde on Denmark's part during the Second Northern War, a war he had himself been in favour of entering.  The treaty, which was concluded in Roskilde on 8 March 1658 (NS), ceded Scania, Halland, Blekinge and Bornholm to Sweden. The Treaty of Elbing was signed between the Dutch Republic and the Swedish Empire on 1 September (OS) / 11 September 1656, during the Second Northern War, in Swedish-held Elbing (Elbląg).  It served to protect Dutch interests in the Baltic Sea, ended the Dutch intervention in the Swedish siege of Danzig, and renewed a fragile peace between the Dutch Republic and Sweden.  Within the former, there was opposition to the treaty demanding elucidations, which were agreed upon only on 29 November (OS) / 9 December 1659 in the Convention of Helsingör.  Earlier in 1659, in the Concert of The Hague, England, France, and the Dutch Republic had agreed to include the treaty of Elbing in their common agenda regarding the Second Northern War. The Treaty of Taastrup (or the Høje Taastrup Peace) was a preliminary accord signed on 11 February 1658 between Charles X Gustav of Sweden and King Frederick III of Denmark.  The treaty was signed at the Høje Taastrup Church.  Individuals such as Count Corfitz Ulfeldt participated in the peace negotiations after Denmark lost in the Second Northern War.  The agreement was finalized through the Treaty of Roskilde.  The original copy of the treaty is at the National Museum of Denmark ("Nationalmuseet") in Copenhagen. The Russo-Polish War of 1654–1667, also called Thirteen Years' War, First Northern War, or the War for Ukraine, was a major conflict between Tsardom of Russia and the Polish-Lithuanian Commonwealth.  Between 1655 and 1660, the Second Northern War was also fought in the Polish-Lithuanian Commonwealth, thus this period became known in Poland as "The Deluge".  The Commonwealth initially suffered defeats, but regained its ground and won most of the battles.  However its plundered economy was not able to fund the long conflict.  Facing internal crisis and civil war, Poland was forced to sign a truce.  The war ended with significant Russian territorial gains and marked the beginning of the rise of Russia as a great power in Eastern Europe. The Treaty or Peace of Oliva of 23 April (OS)/3 May (NS) 1660 (Polish: "Pokój Oliwski" , Swedish: "Freden i Oliva" , German: "Vertrag von Oliva" ) was one of the peace treaties ending the Second Northern War (1655-1660).  At Oliva (Oliwa, Royal Prussia), peace was made between Sweden, the Polish-Lithuanian Commonwealth, the Habsburgs and Brandenburg-Prussia. Swedish Livonia (Swedish: "Svenska Livland" ) was a dominion of the Swedish Empire from 1629 until 1721.  The territory, which constituted the southern part of modern Estonia (including the island of Ösel ceded by Denmark after the Treaty of Brömsebro) and the northern part of modern Latvia (the Vidzeme region), represented the conquest of the major part of the Polish-Lithuanian Duchy of Livonia during the 1600–1629 Polish-Swedish War.  Parts of Livonia and the city of Riga were under Swedish control as early as 1621 and the situation was formalized in Truce of Altmark 1629, but the whole territory was not ceded formally until the Treaty of Oliva in 1660.  The minority part of the Wenden Voivodeship retained by the Polish–Lithuanian Commonwealth was renamed the Inflanty Voivodeship (""Livonian Principality""), which today corresponds to the Latgale region of Latvia. The Treaty of Kėdainiai or Kiejdany, signed on 17 August 1655, was a Swedish–Lithuanian agreement during the Second Northern War.  After the Polish forces had been decisively defeated in the Battle of Ujście, whereupon the Poznań and Kalisz palatines surrendered to Sweden, Lithuanian hetman Janusz Radziwiłł decided to discontinue the war.  In Kėdainiai, he accepted Swedish protection.  The treaty further specified that the Polish–Lithuanian Commonwealth was not dissolved and Lithuanian forces would not fight Polish forces, although the text of the treaty included protests against the lack of Polish support.  On 20 October, the treaty was superseded by the Union of Kėdainiai, which united the Grand Duchy of Lithuania with the Swedish Empire.
Answer: Riga