Jogaila, later Władysław II Jagiełło (] ) (c. 1352/1362 – 1 June 1434) was the Grand Duke of Lithuania (1377–1434) and then the King of Poland (1386–1434), first alongside his wife Jadwiga until 1399, and then sole King of Poland.
 He ruled in Lithuania from 1377.
 Born a pagan, in 1386 he converted to Catholicism and was baptized as Władysław in Kraków, married the young Queen Jadwiga, and was crowned King of Poland as Władysław II Jagiełło.
 In 1387 he converted Lithuania to Christianity.
 His own reign in Poland started in 1399, upon the death of Queen Jadwiga, and lasted a further thirty-five years and laid the foundation for the centuries-long Polish–Lithuanian union.
 He was a member of the Jagiellonian dynasty in Poland that bears his name and was previously also known as the Gediminid dynasty in the Grand Duchy of Lithuania.
 The dynasty ruled both states until 1572, and became one of the most influential dynasties in late medieval and early modern Central and Eastern Europe.
 During his reign, the Polish-Lithuanian state was the largest state in the Christian world.
The House of Sforza (] ) was a ruling family of Renaissance Italy, based in Milan.
 They acquired the Duchy of Milan from the previously-ruling Visconti family in the mid-15th century, and lost it to the Spanish Habsburgs about a century later.
The Macedonian dynasty ruled the Byzantine Empire from 867 to 1056, following the Amorian dynasty.
 During this period, the Byzantine state reached its greatest expanse since the Muslim conquests, and the Macedonian Renaissance in letters and arts began.
 The dynasty was named after its founder, Basil I the Macedonian who came from the Theme of Macedonia which at the time was part of Thrace.
The Khwarazmian dynasty (] ; also known as the Khwarezmid dynasty, the Anushtegin dynasty, the dynasty of Khwarazm Shahs, and other spelling variants; from (Persian: خوارزمشاهیان‎ , "Khwārazmshāhiyān " ‎ "Kings of Khwarezmia") was a Persianate Sunni Muslim dynasty of Turkic "mamluk" origin.
 The dynasty ruled large parts of Central Asia and Iran during the High Middle Ages, in the approximate period of 1077 to 1231, first as vassals of the Seljuqs and Qara-Khitan, and later as independent rulers, up until the Mongol invasion of Khwarezmia in the 13th century.
The term France–Habsburg rivalry (French: "Rivalité franco-habsbourgeoise" ; German: "Habsburgisch-Französischer Gegensatz" ) describes the rivalry between the House of Habsburg and the Kingdom of France.
 The Habsburgs were the largest and most powerful royal house of the Holy Roman Empire from the Early Modern Period until the First World War.
 In addition to holding significant amounts of land and influence within the Holy Roman Empire, the Habsburg dynasty ruled Spain under Charles V.
 As the House of Habsburg expanded into western Europe, border friction began with the Kingdom of France, the lands of which extended to the west bank of the Rhine.
 The subsequent rivalry became a cause for several major wars, including the Italian Wars, the Thirty Years' War, the Nine Years' War, the War of Spanish Succession, the War of Austrian Succession, and the Napoleonic Wars.
The history of Italy in the Early Modern period was partially characterized by foreign domination.
 Following the Italian Renaissance Wars (1494–1559), only the Savoyard state, the Republic of Venice, the Duchy of Florence and the Papal States remained independent, while the south of Italy, the Duchy of Milan and other minor Italian states were under direct or indirect control of Habsburg Spain.
 In order to mantain its influence and independence from Savoy and France, the Republic of Genoa became a key ally of the Spanish Empire, providing credit and economic support for the Habsburgs in what has been described as the "age of the Genoese".
The Missa Di dadi, also known as the Dice Mass or Missa N'aray je jamais mieulx, is a musical setting of the Ordinary of the Mass by Franco-Flemish composer Josquin des Prez, probably dating from around 1480.
 It uses the chanson "N'aray je jamais mieulx" by Robert Morton as the source of its cantus firmus, and also contains unique visual and musical references to dice.
 The latter is thought to be a reference to the popularity of gambling in the court of the Sforza family at Milan, where Josquin wrote it.
'Aper-'Anati (also written Aper-Anat and Aperanat) was a ruler of Lower Egypt during the Second Intermediate Period in the mid-17th century BC.
 According to Jürgen von Beckerath he was the second king of the 16th Dynasty and a vassal of the Hyksos kings of the 15th Dynasty.
 This opinion was recently rejected by Kim Ryholt.
 In his 1997 study of the second intermediate period, Ryholt argues that the kings of the 16th Dynasty ruled an independent Theban realm c. 1650–1580 BC.
 Consequently, Ryholt sees 'Aper-'Anati as an early Hyksos king of the 15th Dynasty, perhaps its second ruler.
 This analysis has convinced some egyptologists, such as Darrell Baker and Janine Bourriau, but not others including Stephen Quirke.
The Later Lê dynasty (Vietnamese: "Nhà Hậu Lê" ; Hán Việt: 後黎朝), sometimes referred to as the Lê dynasty (the earlier Lê dynasty ruled only for a brief period (980–1009)), was the longest-ruling dynasty of Vietnam, ruling the country from 1428 to 1788, with a brief six-year interruption of the Mạc dynasty usurpers (1527-1533).
 Vietnamese historians usually distinguish the 100-year Later Lê dynasty early period (1428 to 1527) from 256-years of figurehead emperors of the Later Lê dynasty warlord period (1533 to 1789) following the dynasty's restoration by powerful warlords.
Raees Dynasty, founded by Shah Nadir Raees, ruled the princely state of Chitral from 1320 to 1660.
 The Raees dynasty was of Central Asian origin most probably from Eastern Turkistan or from Badakhshan.
 A number of rulers succeeded one after the other during the Raees dynasty and a few of them known in history of the area like Shah Nasir, Shah Tahir Raees, Shah Mahmood and Shah Abdul Qadir.
 In the late period of Raees rule its power greatly weakened due to internecine fights over succession which was taken advantage of by the Katoors.
 While the Raees were busy fighting each other the Katoors mounted an attack on the ruling family with the help of other prominent tribes and took over the reigns of the state.
 The prominent features of Raees rule were the unification of Upper Chitral and Lower Chitral into a single state, spread of Islam, introduction of Islamic system, introduction of taxation and a good administrative system.
 The dynasty ruled over Chitral till 1590 uninterruptedly when Muhtaram Shah Kator overthrew Shah Mehmood Raees in 1590.
 However Shah Mehmood Raees regained his power in 1630.
The Raees rule lingered on till 1698 when Shah Alam Katoor replaced the last Raees ruler Shah Abdul Qadir Raees who ruled from 1697-98.

Question: Which dynasty ruled in Milan during the Renaissance period, but later lost the Duchy to the Habsburgs from Spain?
Answer: Sforza family