Rosetta Problems

Construction of a tree

https://atcoder.jp/contests/agc029/tasks/agc029_f