1032 - Jim

Time Limit : 5 Second

Memory Limit : 128 MB

Submission: 96

Solved: 33

Jim is boss of a big company . There are so many workers in his company that it will take a long time for his command send to all of his workers . One day he want to know how long it will take at least . So he ask you , one of his best programer , to solve the problem .
All the workers in Jim's conpany will receive command from only one people . So there is a tree (the root is Jim) identify the order Jim's command will send by . One send command to another will cost 1 minute and anyone can't send command to more than one people at the same time .
There will be multiple cases in the input . For each case there will be just one number N (N<=10000) in the first line , then N-1 fellowed , each line with two names: worker1 worker2 , that is to say worker2 send command to worker1 . The name of the workers will only contain characters and the length is at most 5 .
Just one number to tell how many minutes it will cost at least .
sample input
Tom Jim
Bob Jim
John Tom
Mily Tom
sample output
Wu Shaoliang
© 2015 HUST ACMICPC TEAM. All Right Reserved.