Cities first arose when farmers had surplus grain production and needed storage, leading to large communal buildings and division of labor with specialists like weavers and blacksmiths. As cities grew, they required governance with rules, administration of food and people, which led to the development of writing to keep records and address new problems that came with urban living.