You are given a tree with n vertices and k edges. Each edge has a color between 1 and k. For each i, from 1 to k, determine the number of paths (v, u) in the tree with i different colors.
Note: (v,u)≠(u,v)
Input format
First line: n and k
Next n−1 lines: Each line contains two numbers pi and ci denoting the parent of (i+1)th node and the color of the edge connecting i+1 to pi.
Output format
Print k numbers where the ith number denotes the number of paths containing i different colors.
Constraints
1≤n≤1051≤k≤51≤pi<i
-