The Mackenzie programming club has decided to celebrate the holidays by decorating a tree. Being the programming club, their tree is of course a tree rooted at with vertices numbered from to . They would like to light up their tree by placing a colourful LED on each vertex of the tree.
The subtree rooted at a vertex is called colourful if every descendant of the vertex (including the vertex itself) has a different colour. The club would like at least colourful subtrees in their tree. Since buying LEDs of different colours is expensive, the club would like to use as few colours as possible to achieve their goal. Could you help them out?
Input Specification
The first line of input contains a three integers , the number of vertices in the tree, the root vertex of the tree, and the number of colourful subtrees desired, respectively. The next lines each contain two integers , representing an edge in the tree.
For of the points, .
Output Specification
The minimum number of different colours required in order to create a tree with at least colourful subtrees.
Sample Input 1
3 1 2
1 2
1 3
Sample Output 1
1
Sample Input 2
5 1 3
1 2
2 3
3 4
4 5
Sample Output 2
3
Comments