Score After Removals

There is an undirected tree with n nodes labeled 0 to n-1, given by edges array where edges[i] = [ui, vi]. Each node has a value. Remove exactly two edges to split the tree into three connected components. The score is the maximum XOR value among the three components. Return the minimum possible score.

Examples
Input: [4,[[0,1],[1,2],[2,3]],[1,2,3,4]]
Output: 4
Hints

Score After Removals

There is an undirected tree with n nodes labeled 0 to n-1, given by edges array where edges[i] = [ui, vi]. Each node has a value. Remove exactly two edges to split the tree into three connected components. The score is the maximum XOR value among the three components. Return the minimum possible score.