There was a fashion for literati to write poems whenever they had inspiration, especially through Tibi Shi 題壁詩 [writing poems on the walls]. It was a way to showcase their ingenuity. It started in the Han dynasty and was popularized during the Tang and Song dynasties.