Stephen Báthory was born on 27 September 1533 in the castle at Somlyó, also known as Szilágysomlyó . He was the son of Stephen VIII Báthory  of the noble Hungarian Báthory family and his wife Catherine Telegdi. He had at least five siblings: two brothers and three sisters. Little is known about his childhood. Around 1549-1550 he briefly visited Italy and probably spent a few months attending lectures at the Padua University. Upon his return, he joined the army of Ferdinand I, Holy Roman Emperor, and took part in his military struggle against the Turks. Some time after 1553 Báthory was captured by the Turks, and after Ferdinand I refused to pay his ransom, joined the opposing side, supporting John II Sigismund Zápolya in his struggle for power in the Eastern Hungarian Kingdom. As Zápolya's supporter, Báthory acted both as a feudal lord, military commander and a diplomat. During one of his trips to Vienna he was put under house arrest for two years. During this time he fell out of favour at Zápolya's court, and his position was largely assumed by another Hungarian noble, Gáspár Bekes. Báthory briefly retired from politics, but he still wielded considerable influence and was seen as a possible successor to Zápolya. After Zápolya's death in 1571, the Transylvanian estates elected Báthory Voivode of Transylvania. Bekes, supported by the Habsburgs, disputed his election, but by 1573 Báthory emerged victorious in the resulting civil war and drove Bekes out of Transylvania. He subsequently attempted to play the Ottomans and the Holy Roman Empire against one another in an attempt to strengthen the Transylvania position.
Question: Which happened first, Stephen Báthory fighting for Ferdinand I, or Stephen Báthory fighting for John II Sigismund Zápolya?
Answer: Stephen Báthory fighting for Ferdinand I