A Simple Mechanism for Complex Social Behavior