Rise of complex social structures