import sys
lst = list(map(int,input().split()))
if 0 in lst:
    lst.remove(0)
lst.reverse()
for i in lst:
    print(i,end=" ")