Problem A
Kitten on a Tree

Input
The input is a description of a single tree. The first line
contains an integer
The illustration above corresponds to the sample input.
Output
Output the path to the ground, starting with the branch on which the kitten sits.
Sample Input 1 | Sample Output 1 |
---|---|
14 25 24 4 3 1 2 13 9 4 11 10 20 8 7 32 10 21 23 13 19 32 22 19 12 5 14 17 30 14 6 15 16 30 18 31 29 24 23 26 26 27 28 -1 |
14 19 23 24 25 |