You are given a tree with vertices numbered .
Perform the following operation exactly once to obtain a new tree .
- Delete one edge of .
- Add one edge whose endpoints belong to different connected components after the deletion.
- The added edge must be different from the deleted edge.
For a tree , let denote the distance between vertices and . Define the amount of change between and as the number of unordered vertex pairs satisfying
Find the minimum possible amount of change.
Input
The input is given from Standard Input in the following format:
Each case is given in the following format:
For each , there is an edge connecting vertices and .
Output
For each test case, print the minimum possible amount of change on one line.
Constraints
- .
- .
- ().
- The given graph is a tree.
- The sum of over all test cases does not exceed .
Subtasks
Samples
입력
4
3
1 2
2 3
4
1 2
2 3
3 4
4
1 2
1 3
1 4
6
1 2
2 3
3 4
3 5
3 6
출력
2
2
3
2