

A subtree of a tree T is a tree S consisting of a node in T and all of its descendants in T. The subtree corresponding to the root node is the entire tree. For better understanding, refer to the image below:-

1. The tree will always be rooted at 0.
2. You can return the count of nodes in any order.
3. The root of any subtree is also counted in the subtree thus the count of nodes in a subtree rooted at a leaf node is
4. You can return the numbers in any order.
The first line of the input contains a single integer 'T', representing the number of test cases.
The first line of each test case consists of a single integer 'N', representing the number of nodes in the given tree.
The next 'N' - 1 lines of each test case contain two space-separated integers 'U' and 'V', denoting an edge between the node 'U' and the node 'V'.
For each test case, print the number of nodes in all subtrees of the given tree, in any order.
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 100
1 <= N, E <= 10^4
0 <= U,V < N
Time Limit: 1sec
An easy way to solve this problem will be to run a modified DFS over the given tree.