Optimal Contracts When Agents Envy Each Other