word_list =[]
while True:
    word = input("")
    if word != "0":
        word_list.append(word)
    else:
        break
print(" ".join(word_list))