#include<iostream>
#include<string>
using namespace std;
int main(){
int i, arry[200000] = {0,0};
char c;
string str[200000];
for (i =1;; i++)
{
c = getchar();
if (c == ' ')
{
if (arry[i] == 0)
i--;
}
else if (c == '\n')
{
if (arry[i] == 0)
i--;
break;
}
else
{
str[i] += c; arry[i] = 1; i--;
}
}
for (int j = i; j >0; j--)
{
if (j != i)
cout << ' ';
cout << str[j];
}
}