Joanna la Beltraneja, born in 1462, the first and only daughter of King Henry IV of Castile, was of Asturias. A rumour spread that Princess Joanna was not actually the daughter of King Henry but rather of Beltrán de la Cueva, the alleged lover of Queen Joan of Portugal. Joanna was thus nicknamed "la Beltraneja", as a mocking reference to her assumed father. Pressure from members of the nobility forced the King to strip her of the title and name his half-brother Alfonso as heir, in 1464. In 1465, a group of nobility assembled in Ávila and overthrew King Henry, replacing him with Alfonso. That led to a war that ended in 1468 with the death of the 14-year-old Alfonso. Henry IV regained the throne, but the title of heir became disputed between Joanna, his daughter, and Isabella, his half-sister. That was resolved via the Treaty of the Bulls of Guisando, which gave Isabella succession rights but restricted her marriage options. Isabella secretly married Ferdinand in 1469 at the age of 17, ignoring Henry IV's wishes. Gradually, the couple gained a larger number of supporters and obtained a papal bull sanctioning their marriage from Pope Sixtus IV in 1472 and gained the support of the powerful Mendoza family in 1473. When Henry IV died in December 1474, both candidates for the throne were proclaimed Queen of Castile by their respective supporters. Aware of their position of weakness against Isabella's supporters, Joanna's supporters proposed for the 43-year-old King Afonso V of Portugal, a widower for some 20 years, to marry Joanna, his niece, and assume the throne of Castile with her.
Question: Who was named heir first, Joanna la Beltraneja, or Alfonso?
Answer: Alfonso