{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":" \n \u003cp\u003e\u003cstrong\u003eJin Yong\u003c/strong\u003e was the most famous and popular Chinese wuxia (The one who fight bad people by his Wukong i.e. Wushu and Kongfu) novelist who lived in Hong Kong. Between 1955 and 1972, he wrote 14 novels which earned him a reputation as one of the greatest and most popular Chinese writers. Over 100 million copies of his works have been sold worldwide,not including a countless number of pirated copies. Jin Yong’s works seem to have magic. Once you begin to read a novel of his, you just can’t stop until you finish it.\u003c/p\u003e \n \u003cp\u003eLast month, Jin Yong passed away at the age of 94. Many Jin Yong’s fans in PKU held a meeting to memorize him. Jin Yong’s fans always like to discuss or argue or even quarrel about whose Wukong are better among the wuxia characters of his novel. During the meeting, this happened again:\u003c/p\u003e \n \u003cp\u003eEvery fans said some words like \"Qiao Feng\u0027s Wukong is better than Guo Jing\u0027s\". Obviously, those words may contradict each other and then cause quarrels. As a boring and girlfriendless male programmer of EECS school, you always want to make some things. So you are eager to point out the contradictions as soon as possible. That means, you want to find out the first one whose words contradict the words said by others before him.\u003c/p\u003e \n \u003cp\u003ePlease note that if A is better than B, and B is better than C, then of course A must be better than C.\u003c/p\u003e \n "}},{"title":"Input","value":{"format":"HTML","content":" \n \u003cp\u003eThere are no more than 15 test cases.\u003c/p\u003e \n \u003cp\u003eFor each test case:\u003c/p\u003e \n \u003cp\u003eThe first line is an integer n( 1 \u0026lt;\u003d n \u0026lt;\u003d20), meaning that there are n sentences.\u003c/p\u003e \n \u003cp\u003eThe following n lines are those n sentences which is in the format below:\u003c/p\u003e \n \u003cp\u003es1 s2\u003c/p\u003e \n \u003cp\u003eThis means someone said that s1\u0027s Wukong was better than s2\u0027s. Both s1 and s2 are names of Jin Yong\u0027s characters which consists of only English letters. It\u0027s guaranteed that s1 and s2 are different, and their length is no more than 30. Names are case sensitive.\u003c/p\u003e \n "}},{"title":"Output","value":{"format":"HTML","content":" \n \u003cp\u003eFor each test case, print the first sentence which cause a contradiction. If there are no contradiction, print 0 instead.\u003c/p\u003e \n "}},{"title":"Sample Input","value":{"format":"HTML","content":" \n \u003cpre\u003e2\nBrokenReputation ExtinctNun\nHelloLaught EnvelopeNotFlat\n6\nLandOverWind LonelyLight\nFireMonk CutTheForest\nCutTheForest LookCrazy\nMakeFoxRush LetMeGo\nHeroAunt UniqueLand\nLookCrazy FireMonk\u003c/pre\u003e \n "}},{"title":"Sample Output","value":{"format":"HTML","content":" \n \u003cpre\u003e0\nLookCrazy FireMonk\u003c/pre\u003e \n "}},{"title":"Hint","value":{"format":"HTML","content":" \n \u003cp\u003eDON\u0027T try to figure out who are those names in the sample and waste your time.\u003cbr\u003e\u003c/p\u003e \n \u003c/div\u003e \n "}},{"title":"hint","value":{"format":"HTML","content":"\u003c/h4\u003e \n \u003cimg SRC\u003d\"CDN_BASE_URL/943902017c4a5417480565b112246dae?v\u003d1544218775\" width\u003d\"150px\"\u003e \n \u003cstyle type\u003d\"text/css\"\u003e\n#problem-table \u003e thead \u003e tr \u003e th, #problem-table \u003e tbody \u003e tr \u003e td\n{\n padding: 3px 5px;\n border: 1px solid black;\n}\n\u003c/style\u003e \n "}}]}