{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\r\n\tThe number of students interested to participate in this year\u0026#39;s \u003cem\u003e\u003cspan data-scayt_word\u003d\"Intra-BUET\" data-scaytid\u003d\"23\"\u003eIntra-BUET\u003c/span\u003e Programming Contest\u003c/em\u003e is huge. Since it is very difficult to accommodate such a large number of students in our labs, we have decided to arrange a \u003cem\u003eScreening Test\u003c/em\u003e. The test will be paper-based and may include as many as 100 analytical problems from as many as 20 categories. I have been assigned the job of setting problems for this test.\u003c/p\u003e\r\n\u003cp\u003e\r\n\tAt first, the job seemed to be very easy since I was told that I would be provided with a pool of about 1000 analytical problems already divided into appropriate categories. But after getting the problems I discovered that for many problems the original authors were not sure about the appropriate categories and so they wrote down multiple category-names in the category fields. Since in the \u003cem\u003eScreening Test\u003c/em\u003e a problem cannot be placed under more than one category and the number of problems to be set under each category is fixed, setting problems for this test is not actually easy.\u003cbr /\u003e\r\n\tI know that a program can be written that can do the job automatically. But since I don\u0026#39;t like writing programs, I seek your help.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e\r\n\tThe input file may contain multiple test cases. Each test case begins with a line containing two integers: \u003cem\u003en\u003csub\u003ek\u003c/sub\u003e\u003c/em\u003e and \u003cem\u003en\u003csub\u003ep\u003c/sub\u003e\u003c/em\u003e (2 \u0026lt;\u003d \u003cem\u003en\u003csub\u003ek\u003c/sub\u003e\u003c/em\u003e \u0026lt;\u003d 20, \u003cem\u003en\u003csub\u003ek\u003c/sub\u003e\u003c/em\u003e \u0026lt;\u003d \u003cem\u003en\u003csub\u003ep\u003c/sub\u003e\u003c/em\u003e \u0026lt;\u003d 1000) where \u003cem\u003en\u003csub\u003ek\u003c/sub\u003e\u003c/em\u003e is the number of categories and \u003cem\u003en\u003csub\u003ep\u003c/sub\u003e\u003c/em\u003e is the number of problems in the pool. The second line contains \u003cem\u003en\u003csub\u003ek\u003c/sub\u003e\u003c/em\u003e positive integers where the \u003cspan data-scayt_word\u003d\"i-th\" data-scaytid\u003d\"24\"\u003e\u003cem\u003ei\u003c/em\u003e-th\u003c/span\u003e integer specifies the number of problems to be included in category \u003cem\u003ei\u003c/em\u003e (1 \u0026lt;\u003d \u003cem\u003ei\u003c/em\u003e \u0026lt;\u003d\u003cem\u003en\u003csub\u003ek\u003c/sub\u003e\u003c/em\u003e) of the test. You may assume that the sum of these \u003cem\u003en\u003csub\u003ek\u003c/sub\u003e\u003c/em\u003e integers will never exceed 100. The \u003cspan data-scayt_word\u003d\"j-th\" data-scaytid\u003d\"25\"\u003e\u003cem\u003ej\u003c/em\u003e-th\u003c/span\u003e (1 \u0026lt;\u003d \u003cem\u003ej\u003c/em\u003e \u0026lt;\u003d\u003cem\u003en\u003csub\u003ep\u003c/sub\u003e\u003c/em\u003e) of the next \u003cem\u003en\u003csub\u003ep\u003c/sub\u003e\u003c/em\u003e lines contains the category information of the \u003cspan data-scayt_word\u003d\"j-th\" data-scaytid\u003d\"26\"\u003e\u003cem\u003ej\u003c/em\u003e-th\u003c/span\u003e problem in the pool. A category specification for a problem start with a positive integer not greater than \u003cem\u003en\u003csub\u003ek\u003c/sub\u003e\u003c/em\u003e, specifying the number of categories in one of which this problem can be included, followed by the category numbers. Category numbers are positive integers not greater than \u003cem\u003en\u003csub\u003ek\u003c/sub\u003e\u003c/em\u003e.\u003c/p\u003e\r\n\u003cp\u003e\r\n\tA test case containing two zeros for \u003cem\u003en\u003csub\u003ek\u003c/sub\u003e\u003c/em\u003e and \u003cem\u003en\u003csub\u003ep\u003c/sub\u003e\u003c/em\u003e terminates the input.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e\r\n\tFor each test case in the input print a line containing either 1 or 0 depending on whether or not problems can be successfully selected form the pool under the given restrictions (1 for success and 0 for failure). In case of successful selection print \u003cem\u003en\u003csub\u003ek\u003c/sub\u003e\u003c/em\u003e additional lines where the \u003cspan data-scayt_word\u003d\"i-th\" data-scaytid\u003d\"30\"\u003e\u003cem\u003ei\u003c/em\u003e-th\u003c/span\u003e (1 \u0026lt;\u003d \u003cem\u003ei\u003c/em\u003e \u0026lt;\u003d \u003cem\u003en\u003csub\u003ek\u003c/sub\u003e\u003c/em\u003e) of these lines contains the problem numbers that can be included in category \u003cem\u003ei\u003c/em\u003e. Problem numbers are positive integers not greater then \u003cem\u003en\u003csub\u003ep\u003c/sub\u003e\u003c/em\u003e and two problem numbers must be separated by a single space character. Note that, in case of successful selection any valid selection will be accepted.\u003c/p\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cp\u003e\r\n\t\u003cspan style\u003d\"font-family:courier new,courier,monospace;\"\u003e\u003cfont size\u003d\"3\"\u003e3 15\u003cbr /\u003e\r\n\t3 3 4\u003cbr /\u003e\r\n\t2 1 2\u003cbr /\u003e\r\n\t1 3\u003cbr /\u003e\r\n\t1 3\u003cbr /\u003e\r\n\t1 3\u003cbr /\u003e\r\n\t1 3\u003cbr /\u003e\r\n\t3 1 2 3\u003cbr /\u003e\r\n\t2 2 3\u003cbr /\u003e\r\n\t2 1 3\u003cbr /\u003e\r\n\t1 2\u003cbr /\u003e\r\n\t1 2\u003cbr /\u003e\r\n\t2 1 2\u003cbr /\u003e\r\n\t2 1 3\u003cbr /\u003e\r\n\t2 1 2\u003cbr /\u003e\r\n\t1 1\u003cbr /\u003e\r\n\t3 1 2 3\u003cbr /\u003e\r\n\t3 15\u003cbr /\u003e\r\n\t7 3 4\u003cbr /\u003e\r\n\t2 1 2\u003cbr /\u003e\r\n\t1 1\u003cbr /\u003e\r\n\t1 2\u003cbr /\u003e\r\n\t1 2\u003cbr /\u003e\r\n\t1 3\u003cbr /\u003e\r\n\t3 1 2 3\u003cbr /\u003e\r\n\t2 2 3\u003cbr /\u003e\r\n\t2 2 3\u003cbr /\u003e\r\n\t1 2\u003cbr /\u003e\r\n\t1 2\u003cbr /\u003e\r\n\t2 2 3\u003cbr /\u003e\r\n\t2 2 3\u003cbr /\u003e\r\n\t2 1 2\u003cbr /\u003e\r\n\t1 1\u003cbr /\u003e\r\n\t3 1 2 3\u003cbr /\u003e\r\n\t0 0\u003c/font\u003e\u003c/span\u003e\u003c/p\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cp\u003e\r\n\t\u003cspan style\u003d\"font-family:courier new,courier,monospace;\"\u003e1\u003cbr /\u003e\r\n\t8 11 12\u003cbr /\u003e\r\n\t1 6 7\u003cbr /\u003e\r\n\t2 3 4 5\u003cbr /\u003e\r\n\t0\u003c/span\u003e\u003c/p\u003e"}}]}