{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cstyle type\u003d\"text/css\"\u003e\r\nh1,h2,h3,h4,h5,h6{margin-bottom:0;}div.textBG p{margin: 0 0 0.0001pt;}\u003c/style\u003e\r\n\u003cp\u003e\r\n\t\u0026nbsp;\u003c/p\u003e\r\n\u003cp\u003e\r\n\t\u0026nbsp;\u003c/p\u003e\r\n\u003cp\u003e\r\n\tIn this problem you will need to find out which task has the most number of dependencies. A task \u003cb\u003eA\u003c/b\u003e depends on another task \u003cb\u003eB\u003c/b\u003e if \u003cb\u003eB\u003c/b\u003e is a direct or indirect dependency of \u003cb\u003eA\u003c/b\u003e.\u003c/p\u003e\r\n\u003cp\u003e\r\n\tFor example, if \u003cb\u003eA\u003c/b\u003e depends on \u003cb\u003eB\u003c/b\u003e and \u003cb\u003eB\u003c/b\u003e depends on \u003cb\u003eC\u003c/b\u003e, then \u003cb\u003eA\u003c/b\u003e has two dependencies, one direct and one indirect.\u003c/p\u003e\r\n\u003cp\u003e\r\n\tYou can assume there will be no cyclic dependencies in the input.\u003c/p\u003e\r\n\u003ch2\u003e\r\n\tInput\u003c/h2\u003e\r\n\u003cp\u003e\r\n\tThe input consists of a set of scenarios. Each scenario begins with one integer \u003cb\u003eN\u003c/b\u003e, \u003cb\u003e0 \u0026lt; N \u0026le; 100\u003c/b\u003e, in a line indicating how many tasks this scenario contains. Then there will be \u003cb\u003eN\u003c/b\u003e lines, one for each task. Each line will contain an integer \u003cb\u003e0 \u0026le; T \u0026le; N-1\u003c/b\u003e, the number of direct dependencies of that task, plus \u003cb\u003eT\u003c/b\u003e integers, the identifiers of that dependencies. Tasks are numbered from \u003cb\u003e1\u003c/b\u003e to \u003cb\u003eN\u003c/b\u003e.\u003c/p\u003e\r\n\u003cp\u003e\r\n\tThe input ends with a scenario where \u003cb\u003eN \u003d 0\u003c/b\u003e.\u003c/p\u003e\r\n\u003ch2\u003e\r\n\tOutput\u003c/h2\u003e\r\n\u003cp\u003e\r\n\tFor each scenario, print the number of the task with the greatest number of dependencies alone in a line. If there are ties, show the task with the lowest identifier.\u003c/p\u003e\r\n\u003ch2\u003e\r\n\tSample Input\u003c/h2\u003e\r\n\u003cpre\u003e\r\n3\r\n1 2\r\n1 3\r\n0\r\n4\r\n2 2 4\r\n0\r\n2 2 4\r\n0\r\n0\r\n\u003c/pre\u003e\r\n\u003ch2\u003e\r\n\tSample Output\u003c/h2\u003e\r\n\u003cpre\u003e\r\n1\r\n1\r\n\u003c/pre\u003e"}}]}