alfabeto = {
    '=.===': "a",  # .-
    '===.=.=.=': 'b',  # -...
    '===.=.===.=': 'c',  # -.-.
    '===.=.=': 'd',  # -..
    '=': 'e',  # .
    '=.=.===.=': 'f',  # ..-.
    '===.===.=': 'g',  # --.
    '=.=.=.=': 'h',  # ....
    '=.=': 'i',  # ..
    '=.===.===.===': 'j',  # .---
    '===.=.===': 'k',  # -.-
    '=.===.=.=': 'l',  # .-..
    '===.===': 'm',  # --
    '===.=': 'n',  # -.
    '===.===.===': 'o',  # ---
    '=.===.===.=': 'p',  # .--.
    '===.===.=.===': 'q',  # --.-
    '=.===.=': 'r',  # .-.
    '=.=.=': 's',  # ...
    '===': 't',  # -
    '=.=.===': 'u',  # ..-
    '=.=.=.===': 'v',  # ...-
    '=.===.===': 'w',  # .--
    '===.=.=.===': 'x',  # -..-
    '===.=.===.===': 'y',  # -.--
    '===.===.=.=': 'z',  # --..    
}

def main():

    casos = int(input())

    for i in range(casos):
        frase = list(map(str, input()[::-1].split("......")))

        for palavras in reversed(frase):
            
            letras = list(map(str, palavras[::-1].split("...")))
            
            for morse in letras:
                if(morse[-1:] == '.'):
                    morse = morse[:-1]
                print(alfabeto[morse], end="")
            
            if(palavras != frase[0]):
                print(" ", end="")
        
        print()

if __name__ == "__main__":
    main()
954ae94a74bff60ab44a624e033d84e5a3328a82
<mask token>

<mask token>


def main():
    casos = int(input())
    for i in range(casos):
        frase = list(map(str, input()[::-1].split('......')))
        for palavras in reversed(frase):
            letras = list(map(str, palavras[::-1].split('...')))
            for morse in letras:
                if morse[-1:] == '.':
                    morse = morse[:-1]
                print(alfabeto[morse], end='')
            if palavras != frase[0]:
                print(' ', end='')
        print()


<mask token>

<mask token>


def main():
    casos = int(input())
    for i in range(casos):
        frase = list(map(str, input()[::-1].split('......')))
        for palavras in reversed(frase):
            letras = list(map(str, palavras[::-1].split('...')))
            for morse in letras:
                if morse[-1:] == '.':
                    morse = morse[:-1]
                print(alfabeto[morse], end='')
            if palavras != frase[0]:
                print(' ', end='')
        print()


if __name__ == '__main__':
    main()

alfabeto = {'=.===': 'a', '===.=.=.=': 'b', '===.=.===.=': 'c', '===.=.=':
    'd', '=': 'e', '=.=.===.=': 'f', '===.===.=': 'g', '=.=.=.=': 'h',
    '=.=': 'i', '=.===.===.===': 'j', '===.=.===': 'k', '=.===.=.=': 'l',
    '===.===': 'm', '===.=': 'n', '===.===.===': 'o', '=.===.===.=': 'p',
    '===.===.=.===': 'q', '=.===.=': 'r', '=.=.=': 's', '===': 't',
    '=.=.===': 'u', '=.=.=.===': 'v', '=.===.===': 'w', '===.=.=.===': 'x',
    '===.=.===.===': 'y', '===.===.=.=': 'z'}


def main():
    casos = int(input())
    for i in range(casos):
        frase = list(map(str, input()[::-1].split('......')))
        for palavras in reversed(frase):
            letras = list(map(str, palavras[::-1].split('...')))
            for morse in letras:
                if morse[-1:] == '.':
                    morse = morse[:-1]
                print(alfabeto[morse], end='')
            if palavras != frase[0]:
                print(' ', end='')
        print()


if __name__ == '__main__':
    main()

alfabeto = {
    '=.===': "a",  # .-
    '===.=.=.=': 'b',  # -...
    '===.=.===.=': 'c',  # -.-.
    '===.=.=': 'd',  # -..
    '=': 'e',  # .
    '=.=.===.=': 'f',  # ..-.
    '===.===.=': 'g',  # --.
    '=.=.=.=': 'h',  # ....
    '=.=': 'i',  # ..
    '=.===.===.===': 'j',  # .---
    '===.=.===': 'k',  # -.-
    '=.===.=.=': 'l',  # .-..
    '===.===': 'm',  # --
    '===.=': 'n',  # -.
    '===.===.===': 'o',  # ---
    '=.===.===.=': 'p',  # .--.
    '===.===.=.===': 'q',  # --.-
    '=.===.=': 'r',  # .-.
    '=.=.=': 's',  # ...
    '===': 't',  # -
    '=.=.===': 'u',  # ..-
    '=.=.=.===': 'v',  # ...-
    '=.===.===': 'w',  # .--
    '===.=.=.===': 'x',  # -..-
    '===.=.===.===': 'y',  # -.--
    '===.===.=.=': 'z',  # --..    
}

def main():

    casos = int(input())

    for i in range(casos):
        frase = list(map(str, input()[::-1].split("......")))

        for palavras in reversed(frase):
            
            letras = list(map(str, palavras[::-1].split("...")))
            
            for morse in letras:
                if(morse[-1:] == '.'):
                    morse = morse[:-1]
                print(alfabeto[morse], end="")
            
            if(palavras != frase[0]):
                print(" ", end="")
        
        print()

if __name__ == "__main__":
    main()