#P442. 练77.1 队列复原
练77.1 队列复原
Description
Xiaogua has arranged the integers from to in a sequence, but he only tells you what number comes after each integer (the number after the last integer is ). Please help restore the complete sequence.
Input Format
The first line contains an integer (), indicating there are integers. The next lines each contain two numbers ,, indicating that the number after integer is .
Output Format
lines, each containing one integer, representing the complete sequence.
Sample
3
1 2
2 3
3 01
2
3