#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main()
{
    string str;
    getline(cin, str);
    vector<string> v;
    int num = str.size();
    while(num > 0)
    {
        string s;
        int num = str.find(' ');
        if(num == -1)// 最后一个单词
        {
            s = str;
            v.push_back(s);
            break;
        }
        s.assign(str, 0, num); //从下标0起,将str的nun个字符赋给s
        str.erase(0,num+1); //从下标0起,删除num个字符
        v.push_back(s);

    }
    for (int i = 0; i < v.size(); i++)
    {
        cout << v[v.size() - 1 - i] << ' ';
    }
    return 0;
}