Consider a tree with N vertices, numbered from 1 to N. Add, if it is possible, a minimum number of edges thus every vertex belongs to exactly one cycle.
输入解释
The input has the following structure:
N
x(1) y(1)
x(2) y(2)
...
x(N-1) y(n-1)
N (3 <= N <=100) is the number of vertices. x(i) and y(i) (x(i), y(i) are integers, 1 <= x(i), y(i) <= N) represent the two vertices connected by the i-th edge.
输出解释
The output will contain the value -1 if the problem doesn't have a solution, otherwise an integer, representing the number of added edges.