You have to keep Livonia (Riga) under your control in 1250AD. However, given that it is included in Prussian spawn zone at this exact date, it is ridicolous, you have to build a large army wasting resources to see the army flipping to the enemy. If you raze Riga then it is autofounded. If you try to settle a second city a two tiles away it flips to Lithuanians, so you have the same problem again. I recommend changing the date. Do it at least 5 turns after Lithuanian spawn, so that the "our units join the enemy" stops, so you can reconquer the city and keep it.