#include <bits/stdc++.h>
using namespace std;
int main() {
string s="hello world 123";
cin>>s;
stack<string>st;
string str="";
for(int i=0;i<s.length();i++){
if(s[i]==' '){
st.push(str);
str="";
}
else str+=s[i];
}
string ans="";
while(st.size()!=1){
ans+=st.top()+" ";
st.pop();
}
ans+=st.top();
cout<<ans;
// your code goes here
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCXN0cmluZyBzPSJoZWxsbyB3b3JsZCAxMjMiOwoJY2luPj5zOwoJc3RhY2s8c3RyaW5nPnN0OwoJc3RyaW5nIHN0cj0iIjsKCWZvcihpbnQgaT0wO2k8cy5sZW5ndGgoKTtpKyspewoJCWlmKHNbaV09PScgJyl7CgkJCXN0LnB1c2goc3RyKTsKCQkJc3RyPSIiOwoJCX0KCQllbHNlIHN0cis9c1tpXTsKCX0KCXN0cmluZyBhbnM9IiI7Cgl3aGlsZShzdC5zaXplKCkhPTEpewoJCWFucys9c3QudG9wKCkrIiAiOwoJCXN0LnBvcCgpOwoJfQoJYW5zKz1zdC50b3AoKTsKCWNvdXQ8PGFuczsKCS8vIHlvdXIgY29kZSBnb2VzIGhlcmUKCXJldHVybiAwOwp9