{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"有一棵n个点的无根树,节点依次编号为1到n,其中节点i的权值为vi,\n定义一棵树的价值为它所有点的权值的异或和。\n现在对于每个[0,m)的整数k,请统计有多少T的非空连通子树的价值等于k。"}},{"title":"Input","value":{"format":"HTML","content":"The first line of the input contains an integer $T(1\\leq T\\leq10)$, denoting the number of test cases. \n\u003cbr\u003e \n\u003cbr\u003eIn each test case, the first line of the input contains two integers $n(n\\leq 1000)$ and $m(1\\leq m\\leq 2^{10})$, denoting the size of the tree $T$ and the upper-bound of $v$. \n\u003cbr\u003e \n\u003cbr\u003eThe second line of the input contains $n$ integers $v_1,v_2,v_3,...,v_n(0\\leq v_i \u0026lt; m)$, denoting the value of each node. \n\u003cbr\u003e \n\u003cbr\u003eEach of the following $n-1$ lines contains two integers $a_i,b_i$, denoting an edge between vertices $a_i$ and $b_i(1\\leq a_i,b_i\\leq n)$. \n\u003cbr\u003e \n\u003cbr\u003eIt is guaranteed that $m$ can be represent as $2^k$, where $k$ is a non-negative integer."}},{"title":"Output","value":{"format":"HTML","content":"For each test case, print a line with $m$ integers, the $i$-th number denotes the number of non-empty subtree of $T$ which value are equal to $i$. \n\u003cbr\u003e \n\u003cbr\u003eThe answer is huge, so please module $10^9+7$."}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e2\n4 4\n2 0 1 3\n1 2\n1 3\n1 4\n4 4\n0 1 3 1\n1 2\n1 3\n1 4\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e3 3 2 3\n2 4 2 3\u003c/pre\u003e"}}]}