Given a cactus graph, compute the maximum distance between two vertices.
Constraints
Input Specification
The first line contains two space-separated integers, and . There are vertices labeled from to .
lines follow. Each line starts with an integer , followed by space-separated integers. Adjacent integers in each line are connected with an edge. The graph is guaranteed to be a connected cactus.
Output Specification
Output the diameter of the graph.
Sample Input
15 3
9 1 2 3 4 5 6 7 8 3
7 2 9 10 11 12 13 10
5 2 14 9 15 10
Sample Output
8
Comments
This comment is hidden due to too much negative feedback. Show it anyway.