Given a tree on $$$n$$$ nodes, answer $$$q$$$ queries of the following form: what's the size of the smallest subset of edges that connects all pairs of nodes $$$(u, v)$$$ for $$$u, v \in [l, r]$$$?
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 10^4$$$). The description of each test case follows.
The first line will contain $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) and $$$q$$$ ($$$1 \leq q \leq 3 \cdot 10^5$$$).
The next $$$n - 1$$$ lines describe the edges of the tree, and the next $$$q$$$ lines describe $$$l$$$ and $$$r$$$ for each query.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$, and the sum of $$$q$$$ over all test cases does not exceed $$$3 \cdot 10^5$$$.
Output $$$q$$$ integers representing the answer to each query.
16 31 22 32 41 55 61 21 34 6
124
For the third query, we must keep at least 4 edges: $$$2-4, 1-2, 1-5$$$, and $$$5-6$$$.