while True:
    try:
        s = input()
        for i in s:
            if not i.isdigit() and not i.isalpha():
                #把其它字符替换为空格
                s = s.replace(i,' ')
        s = s.split()[::-1]
        print(' '.join(s))
    except:
        break