def reverse():
ch = raw_input()
if ch != 'end':
reverse()
print ch,
# input:
# a b c d end
# output:
# end d c b a