a = list(map(int, input().split()))
for i in a[:-2]:
    if a[a.index(i) + 1] == 0:
        a.remove(i)
print(a)