How were kings determined during the Shang dynasty? by heredity by the military by a royal council by popular election