{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"Your task is to divide a number of persons into two teams, in such a way, that:\r\u003cbr\u003e\r\u003cbr\u003eeveryone belongs to one of the teams;\r\u003cbr\u003e\r\u003cbr\u003eevery team has at least one member;\r\u003cbr\u003e\r\u003cbr\u003eevery person in the team knows every other person in his team;\r\u003cbr\u003e\r\u003cbr\u003eteams are as close in their sizes as possible.\r\u003cbr\u003e\r\u003cbr\u003eThis task may have many solutions. You are to find and output any solution, or to report that the solution does not exist."}},{"title":"Input","value":{"format":"HTML","content":"For simplicity, all persons are assigned a unique integer identifier from 1 to N.\r\u003cbr\u003e\r\u003cbr\u003eThe first line in the input file contains a single integer number N (2 \u0026lt;\u003d N \u0026lt;\u003d 100) - the total number of persons to divide into teams, followed by N lines - one line per person in ascending order of their identifiers. Each line contains the list of distinct numbers Aij (1 \u0026lt;\u003d Aij \u0026lt;\u003d N, Aij !\u003d i) separated by spaces. The list represents identifiers of persons that ith person knows. The list is terminated by 0."}},{"title":"Output","value":{"format":"HTML","content":"If the solution to the problem does not exist, then write a single message \"No solution\" (without quotes) to the output file. Otherwise write a solution on two lines. On the first line of the output file write the number of persons in the first team, followed by the identifiers of persons in the first team, placing one space before each identifier. On the second line describe the second team in the same way. You may write teams and identifiers of persons in a team in any order."}},{"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\u003e5\r\n2 3 5 0\r\n1 4 5 3 0\r\n1 2 5 0\r\n1 2 3 0\r\n4 3 2 1 0\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3 1 3 5\r\n2 2 4\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}