The origins of governments: from anarchy to hierarchy