Which son of Sophia of Hanover ruled part of the Holy Roman Empire?