During the reign of Emperor Dezong of the Tang Dynasty, Zhong Kui, a talented but ugly scholar, went to Chang'an to take an examination. He was favored by the examiners Han Yu and Lu Zhi and ranked first. However, when he met with the emperor, Dezong thought he was ugly, and the treacherous minister Lu Qi took the opportunity to propose that he should be disqualified from being the number one scholar. Zhong Kui was so angry that he seized the wat and started beating him, but Dezong ordered him to take it down. Zhong Kui saw that there was no way to redress the injustice, so he drew his sword and killed himself. After his death, he was posthumously named the "Exorcist God" by Emperor Dezong. When he reported to the underworld, the King of Hell thought that there were most evil spirits in the Yang world, so he sent him to the Yang world to kill ghosts. On the way to his post, he recruited two ghosts who had been wronged and wronged as his assistants, and also ordered a little ghost who could turn into a bat as his guide to cross mountains and rivers, overcoming all difficulties, and successively eliminated ghosts with salivating faces, lustful ghosts, hungry ghosts, fake ghosts, traitors, troublemakers, reckless ghosts, scum-grabbing ghosts, careful ghosts, and food-seeking ghosts. Thirty-six ghosts include: , earthly ghost, street ghost, anxious ghost, warm ghost, weak ghost, frivolous ghost, lingering ghost, black-eyed ghost, dirty ghost, warm zombie ghost, unreasonable ghost, cheating ghost, desperate ghost, sick ghost, drunk ghost, pinching ghost, smart ghost, anxious ghost, and liar ghost. After Zhong Kui completed his mission, he was conferred by the Jade Emperor as the "Emperor of Righteousness, Exorcism of Evil and Thunder and Exorcism of Demons" by the Jade Emperor.