Under construction

Still being built. Things may change

Kid's Nightmare

Time limit3sMemory limit1024 MB

Summary
Remove vertices so the remaining graph has no cycles while keeping as many as possible, in a connected graph where every cycle of length four or more has a chord.
Level

Medium7 of 10

Topics
Graph, Greedy, Implementation
Solved
No attempts yet

Problem

Vasya likes trees and hates cycles in graphs very much. Whenever he faces a cactus problem at a contest, he gets upset and starts a discussion on a well-known forum in the community.

Today is the night before an important contest at a training camp, and Vasya has a nightmare. In it, he sees a connected undirected graph full of cycles: cycles with cycles inside them, and more cycles inside those. The graph is so terrible that for every simple cycle with at least four vertices, there is an edge connecting two non-adjacent vertices of that cycle.

The only thing Vasya can do is delete a vertex together with all edges incident to it. Help him delete some vertices so that the number of remaining vertices is as large as possible and the remaining graph has no cycles at all. The graph may become disconnected after the deletions.

Input

The first line contains two integers nn and mm, the number of vertices and edges in the graph (1≤n,m≤200 0001 \le n, m \le 200\,000). Each of the next mm lines contains a pair of integers uu and vv, the vertices connected by an edge (1≤u,v≤n1 \le u, v \le n). It is guaranteed that the graph is connected, has no loops or multiple edges, and that for every simple cycle with at least four vertices, there is an edge connecting two non-adjacent vertices of the cycle.

Output

On the first line, print one integer tt, the maximum number of vertices that can remain in the graph. On the second line, print tt integers, the numbers of the vertices that remain. If there are several solutions, any of them is accepted.

Hint

In the picture below, you can see the graph from sample test 3. Solid vertices and edges are the ones present in the resulting graph, and dashed vertices and edges are the deleted ones.

Examples3

  1. Example 1

    Input
    3 2
    1 2
    2 3
    
    Expected output
    3
    1 2 3
    
  2. Example 2

    Input
    3 3
    1 2
    2 3
    3 1
    
    Expected output
    2
    1 2
    
  3. Example 3

    Input
    8 12
    1 2
    1 3
    1 4
    2 3
    2 4
    3 4
    1 6
    6 5
    1 5
    3 8
    3 7
    8 7
    
    Expected output
    6
    2 4 5 6 7 8