Multi-scripts
Multi-scripts allow you to add elements to either side of an element at the subscript or superscript level.
<math><mmultiscripts><mi>X</mi><mtext>bottom right</mtext><mtext>top right</mtext><mprescripts /><mtext>bottom left</mtext><mtext>top left</mtext></mmultiscripts></math>
Gives:
You can use one of these elements and simply leave out any value within an element to achieve any combination.