Huang Chao led a massive rebellion in the late Tang dynasty, after it had already been weakened by the An Lushan rebellion. He was born to a wealthy family in western Shandong. After repeated failures he created a secret society that engaged in illicit salt trading. Although Huang Chao's rebellion was ultimately defeated, it led to the final disintegration of the Tang dynasty. Among Huang Chao's cohort were other failed candidates such as Li Zhen, who targeted government officials, killed them and threw their bodies into the Yellow River. Zhang Yuanhao of the Northern Song defected to Western Xia after failing the examinations. He aided the Tanguts in setting up a Chinese-style court. Niu Jinxing of the late Ming was a general in Li Zicheng's rebel army. Having failed to become a jinshi, he targeted high officials and members of the royal family, butchering them as retribution. Hong Xiuquan led the mid-19th-century Taiping Rebellion against the Qing dynasty. After his fourth and final attempt at the shenyuand exam, he had a nervous breakdown, during which he had visions of a heaven where he was part of a celestial family. Influenced by the teachings of Christian missionaries, Hong announced to his family and followers that his visions had been of God, his father, and Jesus Christ, his brother. He created the Taiping Heavenly Kingdom and waged war on the Qing dynasty, devastating parts of southeast China which would not recover for decades.