Олимпиадный тренинг

Задача 44648. Bring out the forks


Задача

Темы: Деревья

For the resulting tree, print a list of all vertices that have two children, in ascending order.


Input

Enter a sequence of integers ending in zero. Zero itself is not included in the sequence. Build a tree according to this sequence.


Output

Print the answer to the problem.

 
Examples
# Input Output
1
7 3 2 1 9 5 4 6 8 0
3
5
7