CF1994E Wooden Game
题目描述
### 题目大意
给定一个有根树森林 $K=\left\{T_1,T_2,\dots,T_k\right\}$。Timofey 可以移除森林中任意树的子树,然后将其加入森林。
求 Timofey 通过任意次操作,所能得到的
$$
\bigvee_{i=1}^{|K|}\left|T_i\right|
$$
的最大值,其中 $\bigvee$ 表示按位或。
输入格式
输入数据的第一行包括一个整数 $t\left(1\le t\le10^4\right)$,表示测试用例的组数。
对于每个测试用例:
第一行包括一个整数$k\left(1\le k\le10^6\right)$,表示初始状态下森林中树的数目。
接下来 $2k$ 行依次描述了 $k$ 颗树。对于每颗树:
- 第一行包括一个整数 $n\left(1\le n\le10^6\right)$,表示树中结点的数目。
- 第二行包括 $n-1$ 个整数 $p_2,p_3,\dots,p_n$ $\left(1\le p_i
输出格式
对于每个测试用例,输出一行一个整数,表示能得到的最大值。
说明/提示
In the second test case, the trees look like this:

The first operation removes the entire second tree.

The second operation removes vertex $ 4 $ from the first tree.

The third operation removes the first tree. The result is $ 6|1|3 = 7 $ ( $ | $ denotes bitwise OR).
In the third test case, the entire tree needs to be removed.