#include <iostream>
#include <string>
#include <sstream>
#include <stack>
using namespace std;
string str;
stack<string> s;
int main()
{
while(getline(cin,str))
{
istringstream it(str);
bool isfirst = true;
while ( it >> str )
{
s.push(str);
}
while (!s.empty())
{
if (isfirst)
{
isfirst = false;
cout<<s.top();
}
else
{
cout<<" "<<s.top();
}
s.pop();
}
cout<< endl;
}
return 0;
}