{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eVladislav Isenbaev is a two-time champion of Ural, vice champion of TopCoder Open 2009, and absolute champion of ACM ICPC 2009. In the time you will spend reading this problem statement Vladislav would have solved a problem. Maybe, even two…\r\n\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eSince Vladislav Isenbaev graduated from the Specialized Educational and Scientific Center at Ural State University, many of the former and present contestants at USU have known him for quite a few years. Some of them are proud to say that they either played in the same team with him or played in the same team with one of his teammates…\r\n\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eLet us define \u003ci\u003eIsenbaev\u0027s number\u003c/i\u003e as follows. This number for Vladislav himself is 0. For people who played in the same team with him, the number is 1. For people who weren\u0027t his teammates but played in the same team with one or more of his teammates, the number is 2, and so on. Your task is to automate the process of calculating Isenbaev\u0027s numbers so that each contestant at USU would know their proximity to the ACM ICPC champion.\r\n\u003c/div\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eThe first line contains the number of teams \u003ci\u003en\u003c/i\u003e (1 ≤ \u003ci\u003en\u003c/i\u003e ≤ 100). In each of the following \u003ci\u003en\u003c/i\u003e lines you are given the names of the three members of the corresponding team. The names are separated with a space. Each name is a nonempty line consisting of English letters, and its length is at most 20 symbols. The first letter of a name is capital and the other letters are lowercase.\r\n\u003c/div\u003e\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eFor each contestant mentioned in the input data output a line with their name and Isenbaev\u0027s number. If the number is undefined, output “undefined” instead of it. The contestants must be ordered lexicographically.\r\n\u003c/div\u003e\u003c/div\u003e"}},{"title":"Sample","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\r\nIsenbaev Oparin Toropov\r\nAyzenshteyn Oparin Samsonov\r\nAyzenshteyn Chevdar Samsonov\r\nFominykh Isenbaev Oparin\r\nDublennykh Fominykh Ivankov\r\nBurmistrov Dublennykh Kurpilyanskiy\r\nCormen Leiserson Rivest\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eAyzenshteyn 2\r\nBurmistrov 3\r\nChevdar 3\r\nCormen undefined\r\nDublennykh 2\r\nFominykh 1\r\nIsenbaev 0\r\nIvankov 2\r\nKurpilyanskiy 3\r\nLeiserson undefined\r\nOparin 1\r\nRivest undefined\r\nSamsonov 2\r\nToropov 1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}