#P3174. [HAOI2009] 毛毛虫
[HAOI2009] 毛毛虫
Description
For a tree, we can extract some path together with the edges incident to that path; it looks like a caterpillar. The more vertices it contains, the larger the caterpillar. For example, extracting part of the tree on the left (Figure ) yields the caterpillar on the right (Figure ).

Input Format
The first line contains two integers , denoting the number of vertices and the number of edges in the tree.
The next lines each contain two integers , indicating that there is an edge between vertices and (). You may assume that no identical pair appears more than once.
Output Format
Output a single integer on one line, representing the size of the largest caterpillar.
13 12
1 2
1 5
1 6
3 2
4 2
5 7
5 8
7 9
7 10
7 11
8 12
8 13
11
Hint
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号