There is a country consisting of N cities numbered with integer numbers from 0 to N−1 with values Ai(0≤i≤N−1), and N−1 bidirectional roads connecting them, such that we can travel between any two cities using these roads. In other words, these cities and roads form a tree.
The president has assigned Q tasks to Q people, and each person has to visit a city V from their current city U to complete their work. However, due to the long travel distances, the president allows them to relax at cities having value K. The workers have come to you seeking assistance in determining the maximum number of cities where they can relax. Your task is to help them find the maximum number of cities where they can relax.
Input format
Output format
For each task, print the maximum number of cities where they can relax in a new line.
Constraints
2<N≤105
0≤u,v≤N−1
0<Q≤105
0≤U,V≤N−1
U≠V
0<Ai , K≤109