Input (grade 13): He was given these names after his father (Juan de Borbón), grandfather (Alfonso XIII) and maternal grandfather (Prince Charles of Bourbon-Two Sicilies).
Output (grade 11): His name came from his father (Juan de Borbón), his grandfather (Alfonso XIII) and his mother's father's name (Prince Charles of Bourbon-Two Sicilies).