Family Tree#10383

Family Tree

1 second
128 megabytes
Medium

Farmer John owns a family farm that has been passed down over several generations, and the family roots of his cows can likewise be traced back several generations on the same farm. Farmer John is curious how the cows in his current herd are related to each other, and he has been examining old records to find out. Help him in this endeavor!

Input

The first line contains an integer n~(1 \le n \le 100) followed by the names of two cows. Each cow name is a string of at most uppercase letters ( to ). Farmer John wants to know how these two cows are related.

Each of the next lines contains two cow names and , meaning that is the mother of .

Output

Print one line describing the relationship between the two cows given in the first line of the input. For simplicity, in the descriptions below, we call these two cows BESSIE and ELSIE. The possible relationships are as follows:

  • If BESSIE and ELSIE have the same mother, print "SIBLINGS".

  • BESSIE may be a direct descendant of ELSIE, that is, ELSIE may be the mother, grand-mother, great-grand-mother, great-great-grand-mother, and so on, of BESSIE. In this case, print "ELSIE is the (relation) of BESSIE", where (relation) is the appropriate relationship, for example, "great-great-grand-mother".

  • If ELSIE is a child of an ancestor of BESSIE (and ELSIE is neither an ancestor nor a sister of BESSIE), then ELSIE is an aunt of BESSIE. Print "ELSIE is the aunt of BESSIE" if ELSIE is a child of BESSIE's grand-mother, "ELSIE is the great-aunt of BESSIE" if ELSIE is a child of BESSIE's great-grand-mother, "ELSIE is the great-great-aunt of BESSIE" if ELSIE is a child of BESSIE's great-great-grand-mother, and so on.

  • If BESSIE and ELSIE are related in any other way (that is, they have a common ancestor), they are cousins, and you should simply print "COUSINS".

  • If neither cow is a descendant of the other and they have no common ancestor, print "NOT RELATED".

The diagram below illustrates these relationships, which are the only ones you need to consider. Note that some relationships, such as "niece" (the daughter of a sister), are not needed: if BESSIE is a niece of ELSIE, then ELSIE is an aunt of BESSIE.

Examples

Example 1

Loading
Loading