- JZPTREE 公式的问题
There is a tree,there is a life.Can you solve this problem about tree?
Here we have a tree which has n vertices.
We define dist(u, v) as the number of edges on the path from u to v.
And for each vertices u , define Eu =
Give you the tree and k.
Print Ei for every vertices(from 1 to n).(mod 10007 for convenience).
The first line contains integer T(1 T 5),denote the number of the test cases.
For each test cases,the first line contains two integers n,k(1<=n<=50000, 1<=k<=500).
Then next n-1 lines,each lines contains two integer a,b(1<=a, b<=n),denote there is an edge between a, b.
For each test cases,print n lines,the i-th line contains Ei.