A tercet is a form of verse that consists of three lines that are often rhymed together or that they rhyme with another tercet, creating a rhythmic flow. There are several forms of tercets.
One form of a tercet is a Haiku and it was originated in Japan. It is a full poem consisting of three lines, usually concerning nature, and its specific structure is: five syllables in the first line, seven syllables in the second line, and five syllables in the third line.
Twain uses irony and sarcasm to characterize the king and duke in such a way that communicates his belief that pretending to be something you are not (for the sake of appearances) is both ridiculous and embarrassing.