In early cities, who generally managed the allocation of resources?