A team of speleologists holds a training session in the Great Cave of the Byte Mountains. During the training, each speleologist explores one route from the Top Chamber to the Bottom Chamber. A speleologist may move downward only: every chamber along a route must lie strictly below the previous one.
In addition, each speleologist must leave the Top Chamber through a different corridor, and each of them must enter the Bottom Chamber through a different corridor. The corridors in between may be used by more than one speleologist. What is the maximum number of speleologists that can train at the same time?
Write a program that:
The first line contains one integer n (2≤n≤200), the number of chambers in the cave. The chambers are numbered from 1 to n from top to bottom: a chamber with a larger number lies lower (at a lower level), the Top Chamber is number 1, and the Bottom Chamber is number n. Every corridor always leads from a lower-numbered chamber to a higher-numbered one, that is, downward.
Each of the next n−1 lines (lines 2 through n) describes one chamber: line i+1 describes chamber i. It begins with an integer m (0≤m≤n−i+1), the number of corridors leaving chamber i, followed by the numbers of the m chambers those corridors lead to. All of these numbers are greater than i.
Print a single integer on one line: the maximum number of speleologists that can train simultaneously.
