QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 32 MB Total points: 100

#11868. Two Parties

الإحصائيات

King Byteasar has decided to throw two great parties and wants to invite to them every single Byteotian inhabitant. Of course he wants to invite each of them to exactly one of the parties. The king knows from his own vast experience that a person is having a good time when there is an even number of her/his friends at the party. Thus he has asked you to divide the country's inhabitants between two parties in a way that as many people as possible have an even number of friends at their party. A trivial division, i.e. one that leaves one party with no guests invited, is allowed. The acquaintanceship is a symmetric relation, i.e. whenever a person $A$ knows the person $B$, the person B also knows the person $A$.

Write a programme that:

  • reads from the standard input the number of Byteotia's inhabitants and the description of their acquaintances,
  • splits the inhabitants into two parties in such way that the number of people who have an even number of friends at their party is as large as possible,
  • writes to the standard output a list of people who should be invited to the first party.

Input

In the first line of the standard input there is one integer $N$ ($1 ≤ N ≤ 200$) - it is the number of inhabitants of Byteotia. The inhabitants are numbered from $1$ to $N$. In the following $N$ lines there are the descriptions of subsequent persons' acquaintances. At the beginning of the $(i+1)$'th line there is an integer $l_i$ ($0 ≤ l_i ≤ N-1$) - the number of friends of the ith inhabitant. It is followed by $l_i$ pairwise distinct numbers of the $i$'th inhabitant's friends. We assume that no inhabitant is her/his own friend. It follows that each acquaintance is written twice: if $A$ and $B$ know each other, then $B$ appears on $A$'s list of friends and $A$ appears on $B$'s.

Output

In the first line of the standard output your programme should write one integer $M$ - the number of people who are to come to the first party. In the second line the $M$ numbers of these people should be written. The rest shall come to the second party.

There are many correct divisions in this task - your programme should write any one of them.

Example

Input

5
3 2 3 4
2 1 3
4 2 1 4 5
2 1 3
1 3

Output

3
1 2 3
problem_11868_1.gif

In the above example everyone will have even number of friends at the party.

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.