Professor Oak is visiting a dangerous city. He wants to return to his hotel from a highlight of the city, but the streets have too many tattooed thugs. Therefore, Prof. Oak wants to reach the hotel always staying as far away from the thugs as possible.
The city can be represented as a set of junction and roads. The thugs are always located on junction points. From all the paths that go from the highlight to the hotel, which of them maximizes the minimum distance to the thugs?
Input begins with the number of cases. Every case begins with the number of junctions , the number of roads and the number of thugs . Follow different pairs to indicate a bidirectional road between and . Follow the different positions of the thugs. The junctions are numbered from 1 to . The highlight is at 1 and the hotel is at . There are never thugs at 1 or . There is at least one path from 1 to . Assume , and .
Print the maximum distance to the thugs achievable by a path from the
highlight to the hotel. Print “no thugs” if no thugs can
reach Prof. Oak.
Input
3 6 6 1 1 2 2 6 1 3 3 4 4 6 5 2 5 3 2 1 1 2 2 3 2 4 2 2 4 1 2 3 3 2
Output
2 0 no thugs