#include <stack>
#include <iostream>
#include <string>
using sstack = std::stack<std::string>;
sstack stack_em_up(std::istream& is)
{
sstack result;
std::string token;
while (is >> token)
result.emplace(token);
return result;
}
void break_em_down(sstack s)
{
while (!s.empty())
{
std::cout << s.top() << ' ';
s.pop();
}
}
int main()
{
break_em_down(stack_em_up(std::cin));
}
I2luY2x1ZGUgPHN0YWNrPgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDxzdHJpbmc+Cgp1c2luZyBzc3RhY2sgPSBzdGQ6OnN0YWNrPHN0ZDo6c3RyaW5nPjsKCnNzdGFjayBzdGFja19lbV91cChzdGQ6OmlzdHJlYW0mIGlzKQp7CiAgICBzc3RhY2sgcmVzdWx0OwoKICAgIHN0ZDo6c3RyaW5nIHRva2VuOwogICAgd2hpbGUgKGlzID4+IHRva2VuKQogICAgICAgIHJlc3VsdC5lbXBsYWNlKHRva2VuKTsKCiAgICByZXR1cm4gcmVzdWx0Owp9Cgp2b2lkIGJyZWFrX2VtX2Rvd24oc3N0YWNrIHMpCnsKICAgIHdoaWxlICghcy5lbXB0eSgpKQogICAgewogICAgICAgIHN0ZDo6Y291dCA8PCBzLnRvcCgpIDw8ICcgJzsKICAgICAgICBzLnBvcCgpOwogICAgfQp9CgppbnQgbWFpbigpCnsKICAgIGJyZWFrX2VtX2Rvd24oc3RhY2tfZW1fdXAoc3RkOjpjaW4pKTsKfQ==