I tried to solve that problem, and got WA with 0.00x seconds. So I thought there might be multiple sets of input. There _ARE_ numbers after the first set of data. I tried and tried and ... still got WA.
I try to build the tree recursively, making some weird comparisons between BFS and DFS... Quite Hard to explain - and WA.

Is there any simple approach I didn't realize? Are there some special cases? Some test data would be appreciated.
Thanks in advance.
Christian