时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
Bob has a tree with

nodes and the weight of i-th node is

.
But Bob forgot

, he only remembers

is an integer in

and

for each edge
)
in the tree.
Now Bob wants to know the number of possible values of

.
XOR means bitwise exclusive OR
输入描述:
The first line has one integers
.
Then there are
lines, the i-th line has two integers
.
Then there are
lines, each line has three integers
denote the infomation for each edge.



输出描述:
Output the answer.
示例1
输入
复制
4
0 7
1 6
2 5
3 4
1 2 0
1 3 7
2 4 6