A major problem for most early agricultural societies was