{"trustable":true,"prependHtml":"\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eYour task is to divide a number of persons into two teams, in such a way, that:\u003cbr\u003e\n \u003cbr\u003e\n everyone belongs to one of the teams;\u003cbr\u003e\n \u003cbr\u003e\n every team has at least one member;\u003cbr\u003e\n \u003cbr\u003e\n every person in the team knows every other person in his team;\u003cbr\u003e\n \u003cbr\u003e\n teams are as close in their sizes as possible.\u003cbr\u003e\n \u003cbr\u003e\n This task may have many solutions. You are to find and output any solution, \n or to report that the solution does not exist.\u003c/p\u003e\n\u003cp\u003e\u003cbr\u003e\n \u003cb\u003eInput\u003c/b\u003e\u003cbr\u003e\n \u003cbr\u003e\n For simplicity, all persons are assigned a unique integer identifier from 1 \n to N.\u003cbr\u003e\n \u003cbr\u003e\n The first line in the input file contains a single integer number N (2 \u0026lt;\u003d \n N \u0026lt;\u003d 100) - the total number of persons to divide into teams, followed by \n N lines - one line per person in ascending order of their identifiers. Each \n line contains the list of distinct numbers Aij (1 \u0026lt;\u003d Aij \u0026lt;\u003d N, Aij !\u003d \n i) separated by spaces. The list represents identifiers of persons that ith \n person knows. The list is terminated by 0.\u003c/p\u003e\n\u003cp\u003e\u003cbr\u003e\n \u003cb\u003eOutput\u003c/b\u003e\u003cbr\u003e\n \u003cbr\u003e\n If the solution to the problem does not exist, then write a single message \"No \n solution\" (without quotes) to the output file. Otherwise write a solution \n on two lines. On the first line of the output file write the number of persons \n in the first team, followed by the identifiers of persons in the first team, \n placing one space before each identifier. On the second line describe the second \n team in the same way. You may write teams and identifiers of persons in a team \n in any order.\u003c/p\u003e\n\u003cp\u003e\u003cbr\u003e\n \u003cb\u003eThis problem contains multiple test cases!\u003c/b\u003e\u003c/p\u003e\n\u003cp\u003eThe first line of a multiple input is an integer N, then a blank line followed \n by N input blocks. Each input block is in the format indicated in the problem \n description. There is a blank line between input blocks.\u003c/p\u003e\n\u003cp\u003eThe output format consists of N output blocks. There is a blank line between \n output blocks.\u003c/p\u003e\n\u003cp\u003e\u003cbr\u003e\n \u003cb\u003eSample Input\u003c/b\u003e\u003cbr\u003e\n \u003cbr\u003e\n 2\u003cbr\u003e\n \u003cbr\u003e\n 5\u003cbr\u003e\n 3 4 5 0\u003cbr\u003e\n 1 3 5 0\u003cbr\u003e\n 2 1 4 5 0\u003cbr\u003e\n 2 3 5 0\u003cbr\u003e\n 1 2 3 4 0\u003cbr\u003e\n \u003cbr\u003e\n 5\u003cbr\u003e\n 2 3 5 0\u003cbr\u003e\n 1 4 5 3 0\u003cbr\u003e\n 1 2 5 0\u003cbr\u003e\n 1 2 3 0\u003cbr\u003e\n 4 3 2 1 0\u003c/p\u003e\n\u003cp\u003e\u003cbr\u003e\n \u003cb\u003eSample Output\u003c/b\u003e\u003cbr\u003e\n \u003cbr\u003e\n No solution\u003c/p\u003e\n\u003cp\u003e 3 1 3 5\u003cbr\u003e\n 2 2 4\u003cbr\u003e\n\u003c/p\u003e\n"}}]}