{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eFarmer 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!\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe 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.\u003c/p\u003e\u003cp\u003eThe next $$$N$$$ lines each contain two cow names $$$X$$$ and $$$Y$$$, indicating that $$$X$$$ is the mother of $$$Y$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eYou should print one line of output indicating the relationship between the two cows specified on the first line of input (for simplicity, let\u0027s call these two cows BESSIE and ELSIE for the examples below). Here are the different types of relationships that are possible:\u003c/p\u003e\u003cp\u003e- You should output \"SIBLINGS\" if BESSIE and ELSIE have the same mother.\u003c/p\u003e\u003cp\u003e- BESSIE might be a direct descendant of ELSIE, meaning that ELSIE is either the mother, grand-mother, great-grand-mother, great-great-grand-mother, etc., of BESSIE. If this is the case, you should print \"ELSIE is the (relation) of BESSIE\", where (relation) is the appropriate relationship, for example \"great-great-grand-mother\".\u003c/p\u003e\u003cp\u003e- If ELSIE is a child of an ancestor of BESSIE (and ELSIE is not herself an ancestor or sister of BESSIE), then ELSIE is BESSIE\u0027s aunt. You should output \"ELSIE is the aunt of BESSIE\" if ELSIE is a child of BESSIE\u0027s grand-mother, \"ELSIE is the great-aunt of BESSIE\" if ELSIE is a child of BESSIE\u0027s great-grand-mother, \"ELSIE is the great-great-aunt of BESSIE\" if ELSIE is a child of BESSIE\u0027s great-great-grand-mother, and so on.\u003c/p\u003e\u003cp\u003e- If BESSIE and ELSIE are related by any other means (i.e., if they share a common ancestor), they are cousins, and you should simply output \"COUSINS\".\u003c/p\u003e\u003cp\u003e- You should output \"NOT RELATED\" if BESSIE and ELSIE have no common ancestor, or neither is directly descended from the other.\u003c/p\u003e\u003cp\u003eThe 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\u0027s aunt.\u003c/p\u003e"}},{"title":"Examples","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\u003e7 AA BB\nMOTHER AA\nGGMOTHER BB\nMOTHER SISTER\nGMOTHER MOTHER\nGMOTHER AUNT\nAUNT COUSIN\nGGMOTHER GMOTHER\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eBB is the great-aunt of AA\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}