On the twenty-second day of the first month of the first year of shenlong (705), five ministers, Zhang Kamzhi, Cui Xuanwei, Jinghui, Huan Yanfan, and Yuan Shuji, led a forbidden army into the palace to kill Erzhang on the grounds that the two brothers of Empress Wu Zetian's male favorites, Zhang Yizhi and Zhang Changzong, were plotting against each other. Subsequently, the five ministers sent people to surround Wu Zetian's bedchamber and force the empress to abdicate, which was the famous "Shenlong Coup" in the history of the Tang Dynasty.
After the success of the "Shenlong Coup", Emperor Zhongzong of Tang restored li xian to the throne as emperor, and all five ministers with the greatest merit were all made county dukes and all worshiped: Zhang Kamzhi was made the Tianguan (吏部) Shangshu and Tongfengge Luantai Sanpin, Cui Xuanhui was the Neishi (Zhongshu Ling), Huan Yanfan and Jinghui were all Ren Nayan (侍中), and Yuan Shuji was with Fengge Luantai Sanpin (TongzhongShumenxia Sanpin).

In the following period, the restored Tang Dynasty gradually returned to the right track under the auspices of five prime ministers. However, for Emperor Li Xian, this was not the best situation.
When Li Xian "crossed the river in the mud", he had great respect for Zhang Kamzhi and others, but now that he has become the emperor, the position of the five ministers in his heart is completely different. More than twenty years ago, Li Xian first ascended to the imperial throne, but because he had no real power, he was deposed by his mother Wu Zetian after only 55 days as emperor. Now that the throne had been lost and regained, and Wu Zetian had fallen, Li Xian was still unable to exercise his own decisions, because all major state affairs were in the hands of the five ministers. Therefore, Li Xian, who was worried about being deposed again, was more wary than trusting the five ministers who supported him to ascend to the throne.
In order to be able to confront the five ministers, Li Xian first arranged for his wife Empress Wei to bow to the government, and then promoted several "strange" figures to important positions, such as appointing Hu Monk Hui Fan as the Grand Master of Yinqing Guanglu and the Duke of Shangyong County, the warlock Zheng Pusi as the secretary supervisor, and the warlock Ye Jingneng as the guozi supervisor. Among all those who were promoted, the most crucial was Wu Zetian's nephew, Wu Sansi, who was also the relative of Li Xian's children.
After some planning, Li Xian's political strength soon surpassed that of the five ministers. At the suggestion of Wu Sansi, Li Xian, citing the merits of the five ministers to Sheji, made Zhang Kamzhi the King of Hanyang County, Cui Xuanwei the Prince of Boling County, Huan Yanfan the Prince of Fuyang County, Jinghui the Prince of Pingyang County, and Yuan Shuji the King of Nanyang County. At the same time, the five people were dismissed from their posts as prime ministers, and it was stipulated that the five people would enter the palace on the first and fifteenth day of the first month of each month, and the rest of the time did not have to go to the court. That is to say, on the surface, the five ministers were promoted to the five kings, but in fact they lost all political capital.
Soon after the five ministers were crowned king, the five were successively demoted to the title of State Assassin for various inexplicable reasons, and later to the State Sima (州司馬). Subsequently, Wu Sansi blamed Zhang Kamzhi and others for attempting to rebel and demanded that the five people be exterminated. Considering that the five people had the merit of making a decision, and that the impact of exterminating them after a gap of one year was not good, Li Xian adopted a compromise plan and exiled the five people for life: Zhang Kamzhi exiled Taki Prefecture (present-day South of Luoding City, Guangdong), Cui Xuanwei exiled Guzhou (present-day Langshan, Vietnam), Huan Yanfan exiled Tozhou (present-day Shangsi County, Guangxi), Jinghui exiled Qiongzhou (present-day Ding'an County, Hainan), and Yuan Shuji exiled Huanzhou (present-day Huanjiang County, Guangxi). In addition, all the clan children of the five people, all who were over the age of sixteen, were also exiled to Lingnan.
The story of the five ministers does not end here. In order to put an end to future troubles, Wu Sansi sent a man named Zhou Lizhen down to complete the "tail sweeping" work. Zhou Lizhen had a festival with the five ministers, so this opportunity to take revenge on the five ministers was exactly what he wanted.
Zhou Lizhen regretted that before he arrived, Zhang Kamzhi, who was eighty-two years old at the time, and Cui Xuanwei, who was sixty-nine years old, had already died in exile.
In order to miss the next opportunity for revenge, Zhou Lizhen and his men caught up with Huan Yanfan in a hurry. He ordered the bamboo to be sharpened, and then huan Yanfan was dragged back and forth on the bamboo covered with bamboo thorns, torturing him to death.
Jinghui's ending was even worse than Huan Yanfan's, and Zhou Lizhen ordered people to cut off the flesh of his body with a small blade and die after being slashed by a thousand knives.
Yuan Shuji was infused with a poisonous herb juice called "wild kudzu juice". This poisonous herb juice is like an iron hook hook throat after being introduced. Yuan Shuji could not bear the severe pain, and his hands kept scratching the ground, so that all the fingernails of his ten fingers fell off, but he could not survive and could not die. After being completely destroyed, Zhou Lizhen ordered yuan shuji to be beaten to death with a stick.
The five ministers who made great contributions to the restoration of the Tang Dynasty completed the last journey of their lives in such an extremely miserable way. It was not until Later Tang Ruizong succeeded to the throne that the five were unjustly rehabilitated.
References: Old Book of Tang, New Book of Tang, Zizhi Tongjian