You are given a tree consisting of N vertices, rooted at vertex 1. Each vertex consists of a lowercase English alphabet as a node value.
If the ancestor node has the same node value as that of any vertex, then that ancestor node is considered as its valid parent vertex.
Your task is to detach all the nodes from the tree and attach them to any of the valid parent vertices (in the initial tree) and print the number of connected components obtained.
Input format
Output format
For each test case, print a single integer M in a new line representing the number of connected components formed after recreating the tree.
Constraints
1≤T≤10
1≤N≤105
a≤Vali≤z
1≤Ui,Vi≤N,Ui!=Vi
Node 4 can be connected to Node 1.
Node 3 has no ancestors with the same value, thus no parent.
2 components : {1, 2, 4}, {3}