田令孜
Song Wentong apparently became an officer in the Boye Army, which was then stationed at Fengtian (奉天, in modern Xianyang, Shaanxi), in his youth. When the major agrarian rebel Huang Chao captured Chang'an around the new year 881 and forced then-reigning Emperor Xizong (Emperor Xuānzong's grandson) to flee to Chengdu, the Boye Army moved to Fengxiang Circuit and followed the orders of Fengxiang's military governor ("Jiedushi"), the former chancellor Zheng Tian. When Huang sent his major general Shang Rang to attack Zheng, Zheng repelled Shang; in that battle, Song distinguished himself, and thereafter was made a commander in the imperial Shence Army. During his service there, he was once favored by the powerful eunuch Tian Lingzi who adopted him as his son with the name Tian Yanbin ().