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

Задача 44773. Tree traversal


Задача

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

Display all elements of the resulting tree in ascending order.


Input

Enter a sequence of integers ending in zero. Zero itself is not included in the sequence. According to this sequence, you need to build a tree.


Output

Print the answer to the problem.

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