Dictators and Their Viziers: Endogenizing the Loyalty-Competence Trade-Off