Problem c. Гаечка и покраска волос ≡

Author:П.Р. Месенёв   Time limit:5 sec
Input file:Standard input   Memory limit:512 Mb
Output file:Standard output  
Maximum points:75  

Statement

One sunny day, Gaechka decided that her look needed freshening up. "How about something bright, stylish and a little eccentric?" she thought. Dyeing her hair in several colours (split into two groups, warm and cold) seemed a brilliant idea, but it soon became clear that doing it without trouble would not be easy.

Every section of hair was a puzzle of its own. Some paints could sit side by side, others caused strange reactions. When Gaechka tried mixing fluorescent orange with acid blue, Dale was suddenly blinded by the brightness, Chip was left speechless, and Zipper circled nervously over her head until he fell into a jar of paint.

To plan everything properly, Gaechka turned her head into a mathematical problem:

Now the task is simple: split the sections into two groups (two colours) so that the number of edges joining vertices of different colours is as large as possible. "The perfect balance between chaos and harmony," she decided.

Chip set about calculating how much developer was needed, Zipper helped lay out the paints, and Dale kept suggesting "a little more glitter".

Help Gaechka solve this problem so that her new style becomes the most memorable one!

Input format

The first line contains n, the number of vertices. Each following line, up to the end of the input, contains an edge: a pair of vertices u v (1 ≤ u, v ≤ n, u ≠ v). There are no repeated edges; the number of edges is not given.

Output format

Print the vertices of one of the two groups of an optimal partition, separated by spaces, in any order, without repeats. The printed group must contain vertex 1; if there are several optimal partitions, print any of them.

Constraints

1 ≤ n ≤ 39.

Sample tests

No. Standard input Standard output
1
6
1 4
2 5
3 6
1 5 6
2
9
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1

0.125s 0.051s 20