{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cbr\u003eSarah is a girl who likes reading books.\u003cbr\u003eOne day, she wondered about the relationship of a family in a mystery novel. The story said, \u003cul\u003e \u003cli\u003eB is A\u0027s father\u0027s brother\u0027s son, and \u003c/li\u003e\u003cli\u003eC is B\u0027s aunt. \u003c/li\u003e\u003c/ul\u003e Then she asked herself, \"So how many degrees of kinship are there between A and C?\"\u003cbr\u003eThere are two possible relationships between B and C, that is, C is either B\u0027s father\u0027s sister or B\u0027s mother\u0027s sister in the story. If C is B\u0027s father\u0027s sister, C is in the third degree of kinship to A (A\u0027s father\u0027s sister). On the other hand, if C is B\u0027s mother\u0027s sister, C is in the fifth degree of kinship to A (A\u0027s father\u0027s brother\u0027s wife\u0027s sister).\u003cbr\u003eYou are a friend of Sarah\u0027s and good at programming. You can help her by writing a general program to calculate the maximum and minimum degrees of kinship between A and C under given relationship.\u003cbr\u003eThe relationship of A and C is represented by a sequence of the following basic relations: father, mother, son, daughter, husband, wife, brother, sister, grandfather, grandmother, grandson, granddaughter, uncle, aunt, nephew, and niece. Here are some descriptions about these relations: \u003cul\u003e \u003cli\u003e\u003ci\u003eX\u003c/i\u003e\u0027s brother is equivalent to \u003ci\u003eX\u003c/i\u003e\u0027s father\u0027s or mother\u0027s son not identical to \u003ci\u003eX\u003c/i\u003e. \u003c/li\u003e\u003cli\u003e\u003ci\u003eX\u003c/i\u003e\u0027s grandfather is equivalent to \u003ci\u003eX\u003c/i\u003e\u0027s father\u0027s or mother\u0027s father. \u003c/li\u003e\u003cli\u003e\u003ci\u003eX\u003c/i\u003e\u0027s grandson is equivalent to \u003ci\u003eX\u003c/i\u003e\u0027s son\u0027s or daughter\u0027s son. \u003c/li\u003e\u003cli\u003e\u003ci\u003eX\u003c/i\u003e\u0027s uncle is equivalent to \u003ci\u003eX\u003c/i\u003e\u0027s father\u0027s or mother\u0027s brother. \u003c/li\u003e\u003cli\u003e\u003ci\u003eX\u003c/i\u003e\u0027s nephew is equivalent to \u003ci\u003eX\u003c/i\u003e\u0027s brother\u0027s or sister\u0027s son. \u003c/li\u003e\u003cli\u003eSimilar rules apply to sister, grandmother, granddaughter, aunt and niece. \u003c/li\u003e\u003c/ul\u003e\u003cbr\u003eIn this problem, you can assume there are none of the following relations in the family: adoptions, marriages between relatives (i.e.\\ the family tree has no cycles), divorces, remarriages, bigamous marriages and same-sex marriages.\u003cbr\u003eThe degree of kinship is defined as follows: \u003cul\u003e \u003cli\u003eThe distance from \u003ci\u003eX\u003c/i\u003e to \u003ci\u003eX\u003c/i\u003e\u0027s father, \u003ci\u003eX\u003c/i\u003e\u0027s mother, \u003ci\u003eX\u003c/i\u003e\u0027s son or \u003ci\u003eX\u003c/i\u003e\u0027s daughter is one. \u003c/li\u003e\u003cli\u003eThe distance from \u003ci\u003eX\u003c/i\u003e to \u003ci\u003eX\u003c/i\u003e\u0027s husband or \u003ci\u003eX\u003c/i\u003e\u0027s wife is zero. \u003c/li\u003e\u003cli\u003eThe degree of kinship between \u003ci\u003eX\u003c/i\u003e and \u003ci\u003eY\u003c/i\u003e is equal to the shortest distance from \u003ci\u003eX\u003c/i\u003e to \u003ci\u003eY\u003c/i\u003e deduced from the above rules. \u003c/li\u003e\u003c/ul\u003e \u003cbr\u003e\u003cdiv align\u003d\"left\" style\u003d\"margin-top: 1.0em;\"\u003e\u003cb\u003eInput\u003c/b\u003e\u003c/div\u003eThe input is given by one line in the following format:\u003cbr\u003e \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003eC is A\u003c/pre\u003e(\u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003e\u0027s\u003c/pre\u003e \u003ci\u003erelation\u003c/i\u003e)* \u003cbr\u003eHere, \u003ci\u003erelation\u003c/i\u003e is one of the following: \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003efather\u003c/pre\u003e, \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003emother\u003c/pre\u003e, \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003eson\u003c/pre\u003e, \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003edaughter\u003c/pre\u003e, \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003ehusband\u003c/pre\u003e, \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003ewife\u003c/pre\u003e, \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003ebrother\u003c/pre\u003e, \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003esister\u003c/pre\u003e, \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003egrandfather\u003c/pre\u003e, \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003egrandmother\u003c/pre\u003e, \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003egrandson\u003c/pre\u003e, \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003egranddaughter\u003c/pre\u003e, \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003euncle\u003c/pre\u003e, \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003eaunt\u003c/pre\u003e, \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003enephew\u003c/pre\u003e, \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003eniece\u003c/pre\u003e. An asterisk denotes zero or more occurance of portion surrounded by the parentheses. The number of relations is at most ten.\u003cbr\u003e\u003cdiv align\u003d\"left\" style\u003d\"margin-top: 1.0em;\"\u003e\u003cb\u003eOutput\u003c/b\u003e\u003c/div\u003ePrint a line containing the maximum and minimum degrees of kinship separated by space.\u003cbr\u003e"}},{"title":"Sample 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003eC is A\u0027s father\u0027s brother\u0027s son\u0027s aunt\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e5 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 2","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003eC is A\u0027s mother\u0027s brother\u0027s son\u0027s aunt\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e5 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 3","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003eC is A\u0027s son\u0027s mother\u0027s mother\u0027s son\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 4","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003eC is A\u0027s aunt\u0027s niece\u0027s aunt\u0027s niece\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e6 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 5","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003eC is A\u0027s father\u0027s son\u0027s brother\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 6","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003eC is A\u0027s son\u0027s son\u0027s mother\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 7","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003eC is A\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}