Tang dynasty
Zhu Wen, originally a salt smuggler who had served under the rebel Huang Chao, surrendered to Tang forces. By helping to defeat Huang, he was granted a series of rapid military promotions. In 907 the Tang dynasty was ended when Zhu Wen, now a military governor, deposed the last emperor of Tang, Emperor Ai of Tang, and took the throne for himself (known posthumously as Emperor Taizu of Later Liang). He established the Later Liang, which inaugurated the Five Dynasties and Ten Kingdoms period. A year later Zhu Wen had the deposed Emperor Ai poisoned to death.
Xianbei
In 534, the Northern Wei split into an Eastern Wei (534-550) and a Western Wei (535-556) after an uprising in the steppes of North China inhabited by Xianbei and other nomadic peoples. The former evolved into the Northern Qi (550-577), and the latter into the Northern Zhou (557-581), while the Southern Dynasties were pushed to the south of the Yangtze River. In 581, the Prime Minister of Northern Zhou, Yang Jian, founded the Sui dynasty (581-618). His son, the future Emperor Yang of Sui, annihilated the Southern Chen (557-589), the last kingdom of the Southern Dynasties, thereby unifying northern and southern China. After the Sui came to an end amidst peasant rebellions and renegade troops, his cousin, Li Yuan, founded the Tang dynasty (618-907); Li led China to develop into one of the most prosperous states in history. Sui and Tang dynasties were founded by Han Chinese generals who also served the Northern Wei dynasty. Through these political establishments, the Xianbei who entered China were largely merged with the Han, examples such as the wife of Emperor Gaozu of Tang, Duchess Dou and Emperor Taizong of Tang's (Li Shimin's) wife, Empress Zhangsun, both have Xianbei ancestries, while those who remained behind in the northern grassland emerged as later powers to rule over China.