#include<iostream>
using namespace std;
const int N = 110;
string stk[N];
int tt=-1;
void push(string x)
{
stk[++ tt] = x;
}
void pop()
{
cout << stk[tt] << " ";
tt --;
}
int empty()
{
if(tt==-1)
return 0;
return 1;
}
int main()
{
string a,b;
while(cin >> a)
{
push(a);
}
while(empty())
{
pop();
}
return 0;
}