|Online MIPT programming contest||РУССКИЙ|
Time limit = 5 secondsLove-cycle is a company in witch each loves exactly one person from this company and "love-arrows" form a cycle. Size of company should be greater than 2.
Your program should find maximum size love-cycle.
Input Th first line contains number of "loves" M, 1 ≤ M ≤ 500, then M lines with "love-arrows" description follow. Different persons have different names. A person's name is word consisting of latin letters A..Za..z. Length of a name is less then 20. One person may love many persons.
Output Size of maximum love-cycle or 0 if it does not exists.
6 Kolya Olya John Jessy Jessy Kolya Misha Olya Olya John Misha Jessy
2 Kolya Olya Olya Kolya
© acm.mipt DevGroup
The page was generated in 180ms