0.6 Consider a world where a pandemic has imposed a new rule: No party can have more than six assistants. Given the lists of friends of each person in a group, we will call someone the sixth friend if he is not in the top five of at least another person. Being egocentric is not an option to avoid being the sixth friend, and therefore not being able to attend any party!
0.4
Can you compute the number of sixth friends in a group of people?
Input consists of several cases. Each case begins with the number of people , followed by lines, one per person. Every line contains the name of the -th person, his number of friends , and the names of his friends in order, from more to less favorite.
You can assume , that all names are different and consist of between 1 and 10 letters, and . The list of friends of each person only includes names in , but can contain repeated names, including one or more times.
For instance, among the five best friends of Joey in the sample in fact there are only Chandler, Phoebe and Rachel. Janice is the only sixth friend of the first case.
For every case, print the number of sixth friends.
Input
7 Chandler 6 Monica Joey Ross Rachel Phoebe Janice Monica 6 Chandler Monica Rachel Phoebe Joey Janice Janice 3 Janice Chandler Janice Ross 6 Rachel Rachel Rachel Rachel Rachel Janice Rachel 7 Rachel Ross Monica Joey Phoebe Chandler Janice Phoebe 5 Joey Monica Rachel Ross Chandler Joey 8 Chandler Joey Chandler Phoebe Rachel Monica Ross Janice 4 A 3 D D D B 7 B B B B B A A C 0 D 2 D C
Output
1 2