Task: Text Categorization
Input (English): One of its former dynasties featured such kings as Edward the Philosopher, John the Pious, and Alfonso the African. That dynasty took power from the Afonsine Dynasty, this country's branch of the House of Burgundy, after the 1383-1385 Crisis. Power in this country was usurped by the Hapsburgs, when they seized the throne in 1580, but its independence was regained when John II led a rebellion in 1640. The dynasty he founded supplanted the House of Aviz and was named Braganza, and its later rulers named Pedro would hold power in Brazil. FTP, name this country, whose more famous leaders included King John I and Prince Henry the Navigator.
Output (English): History