The Mikado is a comic opera created by Arthur Sullivan (music) and W.S. Gilbert (libretto). The play premiered in 1885 in London. To this day, this comic opera is the most frequently produced Savoy Opera. The play is set in Japan; this way, the author could satirise the government more freely. As with other musicals, this used music to tell the story.
The Mikado has declared that flirting is a crime that would be punished by decapitation. However, in the land on Titipu, a wandering musician named Nanki-Poo (who turned out to be the Mikadoís son), came to town looking for his beloved, Yum-Yum. She is the ward of Ko-Ko, a man sentenced to death but was appointed as Lord High Executioner. In effect, he could not execute himself because that would be suicide which is also forbidden.
In the end, Nanki-Poo got to marry Yum-Yum. The Mikado came looking for Nanki-Poo, thought he was dead, and was so happy to find him alive that he was not mad that he was already married.