# Number of ways to partition a tree(containing values in its nodes) into groups such that each group has xor sum equal to Z

I tried two approaches:
1. Give each edge two numbers on its left and right side denoting xor sum for subtree on its left and right respectively. If total xor sum for whole tree is Z, then it can only be partitioned into odd groups each with xor sum Z. I observed some partition patterns with particular edges as follows.
let edge be denoted by (a--b) where a and b are numbers on its left and right. Then partitions are in the form P1(x--0)P2(0--x)P3 and then recursively check for P1,P2,P3. Similarly if total xor sum is 0, partitions are in the form P1(x--x)P2. But there seems to be analytical formula for this pattern which i cant find.

2.Tree Parent Child relationship: consider a root node and its xor sum for the subtree rooted at this node. Corresponding to this xor sum value, we can partition its child nodes and try to make a formula in terms of no of children and no of ways to partition them recursively but again the expression i get is a mess.