#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

void process(string str, string& res){
    string tmp = "";
    vector<string> vec;
    
    int idx = 0;
    while(str[idx] == ' '){
        idx++;
    }
    str = str.substr(idx);
    str += ' '; //补一个空格,避免最后一个单词无法取出
    
    for(char c : str){
        if(c == ' '){
            if(!tmp.empty()){            
                vec.push_back(tmp);
                tmp.clear();
            }
        }
        else{
            tmp += c;//cout<<tmp<<endl;
        }
    }
    
    reverse(vec.begin(), vec.end());

    for(string s : vec){
        res += s;
        res += " ";
    }
    
    res.pop_back(); //把最后一个空格推出去
}

int main(){
    string str = "";
    getline(cin, str);
    
    //cout<<str<<endl;
    string res = "";
    process(str, res);
    cout<<res<<endl;
    
    return 0;
}