#abc293h. [abc293_h]Optimal Path Decomposition
[abc293_h]Optimal Path Decomposition
Problem Statement
You are given a tree with vertices numbered through . The -th edge connects vertex and vertex .
Find the minimum integer such that you can paint each vertex in a color so that the following two conditions are satisfied. You may use any number of colors.
- For each color, the set of vertices painted in the color is connected and forms a simple path.
- For all simple paths on the tree, there are at most distinct colors of the vertices in the path.
Constraints
- The given graph is a tree.
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
7
3 4
1 5
4 5
1 2
7 4
1 6
Sample Output 1
3
If , the conditions can be satisfied by painting vertices , and in color , vertex in color , and vertex in color . If , there is no way to paint the vertices to satisfy the conditions, so the answer is .
Sample Input 2
6
3 5
6 4
6 3
4 2
1 5
Sample Output 2
1
Sample Input 3
9
1 3
9 5
8 7
2 1
5 2
5 8
4 8
6 1
Sample Output 3
3