because on 3 letters A, Md you have a permutation of 321 instead of 35214. You have to take out the 5 and 4 positions before you decode.

 Code:
 A, Md
 3  21
    
 d, MA
 1  23
_________________________
The Code is out there