|Author:||Anton Karabanov||Time limit:||1 sec|
|Input file:||Standard input||Memory limit:||512 Mb|
|Output file:||Standard output|
Siblings is a term used in social anthropology and other studies, meaning children who have the same parents. Full siblings are the ones who have the same mother and father, and half siblings only have one parent in common. Psychologists, studying sibling rivalry, got their hands on a database, containing data on people living in the same building. Help them find the largest group of full siblings for further studies.
The data is represented as a table with n rows and 3 columns. The first column is a person id. The second and third columns are ids of that person's parents in any order.
The first line of the input contains a single positive integer n — number of rows in the database. The next n lines each have three positive integers xi, yi, zi, separated by a whitespace, — ids as described above.
In the first line output a single positive integer — the largest number of full siblings (it's guaranteed to be unique). In the second line output their ids in ascending order.
2 ≤ n ≤ 105
1 ≤ xi, yi, zi ≤ 109
It's convenient to represent the table from the sample as a graph. It shows that four people (with ids 207, 208, 411 и 511) have common parents. The other groups aren't as large.
|No.||Standard input||Standard output|