#include <iostream>
#include <string>
using namespace std;
int main()
{
string word;
getline(cin,word);
int t=word.length();
for(int i=word.length()-1;i>=0;i--)
{
if(word[i]==' ')
{
for(int j=i+1;j<t;j++)
cout<<word[j];
t=i;
cout<<" ";
}
}
for(int m=0;m<t;m++)
cout<<word[m];
}