Recently I came across this problem from Atcoder Beginner Contest 130
Link-Zig Zag Tree
After trying very hard I was not able to understand the editorial explanation. So I request anyone who knows the problem solution to help me solve it.
Also suggest similar problems