Approach hintTry it first, then revealHide
If n is odd, no split works. Otherwise compute subtree sizes with one DFS: every non-root vertex whose subtree has an even size can be cut from its parent, and these cuts never interfere.
If n is odd, no split works. Otherwise compute subtree sizes with one DFS: every non-root vertex whose subtree has an even size can be cut from its parent, and these cuts never interfere.