Pikachu has already defeated so many legendary Pokemon, and is now organizing the Champions League where champions of all Conferences are going to battle for glory.
There are N Conferences around the world, connected by exactly N−1 bidirectional roads. It is always possible to reach one Conference from another.
To choose the Champion of Champions, Pikachu chooses a set S of Conferences. Now, each Conference champion in S battles with every other Conference champion in S and for each battle, one of the champion has to travel. Pikachu wants to know the maximum distance any champion would travel to battle.
Pikachu has thought of Q such sets. He wants to know the maximum distance for each set so that he can choose the least tiresome set.
Constraints:
Input format:
Output format: