The first line contains an integer $n(1\le n \le 10^6)$ denoting the number of vertices on the tree.
The second line contains $n$ integer $w_i(1 \le w_i \le 10^6)$ denoting the weight of vertex $i$.
Next $n-1$ lines each contains two integer $u,v(1\le u,v \le n)$, denoting there is an edge between $u$ and $v$.
Hint
样例解释$B=\emptyset,\lbrace 3 \rbrace, \lbrace 3,4 \rbrace, \lbrace 1,3,4 \rbrace,\lbrace 1,2,3,4 \rbrace$ respectively.