|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||2||2||1||100.000%|
Farmer John owns a family-run farm that has been passed down over several generations, with a herd of cows whose familial roots can similarly be traced back several generations on the same farm. By examining old records, Farmer John is curious how the cows in his current herd are related to each-other. Please help him in this endeavor!
The first line of input contains $N$ ($1 \leq N \leq 100$) followed by the names of two cows. Cow names are each strings of at most 10 uppercase letters ($A \ldots Z$). Farmer John is curious about the relationship between the two cows on this line of input.
The next $N$ lines each contain two cow names $X$ and $Y$, indicating that $X$ is the mother of $Y$.
You should print one line of output indicating the relationship between the two cows specified on the first line of input (for simplicity, let's call these two cows BESSIE and ELSIE for the examples below). Here are the different types of relationships that are possible:
The following diagram helps illustrate the relationships above, which are the only relationship types you need to consider. Observe that some relationships like "niece" (daughter of sister) are not necessary since if BESSIE is the niece of ELSIE, then ELSIE is BESSIE's aunt.
7 AA BB MOTHER AA GGMOTHER BB MOTHER SISTER GMOTHER MOTHER GMOTHER AUNT AUNT COUSIN GGMOTHER GMOTHER
BB is the great-aunt of AA