Not impossible, but I'd suggest a more display friendly format.
Code:
12
    L
    9
        L
        3
        R
        12
    R
    15
That would show the whole thing clearly and would be much simpler to code.

Disregard if the displaying is for ornamental purposes and not for debugging.