Input to this problem will begin with line containing a single integer n indicating the number of data sets. Each data set will be formatted according to the following description.
A single data set has 2 components:
- Descendant Count - A line containing a single integer X (where 0 < X < 100) indicating the number of Ted's descendants.
- Birth Certificate List - Data for X birth certificates, with one certificate's data per line. Each certificate's data will be of the format "FNAME CNAME FAGE" where:
- FNAME is the father's name.
- CNAME is the child's name.
- FAGE is the integer age of the father on the date of CNAMEs birth.
Note:
- Names are unique identifiers of individuals and contain no embedded white space.
- All of Ted's descendants share Ted's birthday. Therefore, the age difference between any two is an integer number of years. (For those of you that are really picky, assume they were all born at the exact same hour, minute, second, etc... of their birth year.)
- You have a birth certificate for all of Ted's descendants (a complete collection).