In imperial China, the rural population lived in clustered villages, each of which had its own distinctive local customs, festivals, deities, and temples.