#P3429. [POI 2005] DWA-Two Parties

[POI 2005] DWA-Two Parties

Description

The Byzantine king is going to host two large parties and hopes to invite more residents.

From his rich experience, the king knows that if a resident meets an even number of friends at the party, they will be very happy. Therefore, he asks you to assign the country's residents to two parties so that as many people as possible have an even number of friends at the party they attend.

Acquaintance is a symmetric relation: if AA knows BB, then BB also knows AA.

Input Format

There are N+1N+1 lines in total.

The first line contains an integer NN (1N2001 \le N \le 200), the number of residents.

In the next NN lines, the (i+1)(i+1)-th line contains an integer lil_i, the number of friends of the ii-th resident, followed by lil_i integers, which are the indices of the ii-th resident’s friends. We assume no one is their own friend. If BB appears in AA’s friend list, then AA also appears in BB’s list.

Output Format

The first line contains an integer MM, the number of people attending the first party. The second line contains MM integers, which are the indices of the residents going to the first party; the remaining residents go to the second party.

If there are multiple valid answers, output any one of them.

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

Hint

Translated by ChatGPT 5