Query: In what year did Emperor Ling die?
Context: Imperial authority was also seriously challenged by large Daoist religious societies which instigated the Yellow Turban Rebellion and the Five Pecks of Rice Rebellion. Following the death of Emperor Ling (r. 168–189 AD), the palace eunuchs suffered wholesale massacre by military officers, allowing members of the aristocracy and military governors to become warlords and divide the empire. When Cao Pi, King of Wei, usurped the throne from Emperor Xian, the Han dynasty ceased to exist.