Select a rectangular portion beginning with Y. When you paste, you get the following code:
The rectangular selection inserts returns where needed to maintain the structure of the text. Select Get Menu Item State on both lines in the following example.