The input contains several test cases. The first line of each test case contains an integer n, The following n-1 lines each contains three integers
,
,
, which means there is an edge between node u and v of length w.
For each test case output the xor-length of the xor-longest path.