Khun Chang Khun Phaen (, ) is a long Thai epic poem which originated from a legend of Thai folklore and is one of the most notable works in Thai literature. The work's entire length is over 20,000 couplets. Khun Chang and Khun Phaen are the leading male characters, where "Khun" was a junior feudal title given for male commoners. The story recounts the adventurous and amorous struggles of the three main protagonists. Much of their relationship can be described as a love triangle. Khun Phaen (dashing but poor) and Khun Chang (rich but ugly) compete for the lovely Wanthong from childhood for over fifty years. Their stories transpire amid the larger backdrop of national events, including two wars, several abductions, a suspected revolt, an idyllic sojourn in the forest, two court cases, trial by ordeal, jail, and treachery. Ultimately the King of Ayutthaya condemns Wanthong to death for failing to choose between the two men.