import sys
def remove_duplicates(lst):
result = [lst[1]]
for i in range(2, len(lst)):
if result[-1] != lst[i]:
result.append(lst[i])
return result
while True:
try:
tmp = list(map(int, sys.stdin.readline().split()))
ans = remove_duplicates(tmp)
print(*ans, end=' ')
print("$")
except:
exit()