The Shang Dynasty ruled northern China from 1650-1027 BCE. They established the first Chinese civilization, centered around their walled capital of Anyang. Society was divided between an upper class of kings, nobles, and artisans who lived in large houses, and common farmers who lived in small villages. The Shang developed writing, fine pottery, advanced bronze metalworking, and silk production. They practiced human sacrifice in elaborate tombs for kings and believed in an afterlife. The Shang king acted as a priest and communicated with ancestors and gods. Their culture was based on concepts of yin and yang duality and the five elements of nature. The Shang were eventually defeated by the neighboring Zhou kingdom.