Under construction

Still being built. Things may change

Problem That Solves Problems (Incorrectly Implemented Euler Circuit)

Time limit1sMemory limit512 MB

Summary
Given a connected graph with an Euler circuit, list every starting vertex from which the greedy edge walk may fail to build a full circuit.
Level

Medium7 of 10

Topics
Graph, DFS
Solved
No attempts yet

Problem

This problem cannot be submitted. See the problem "Problem That Solves Problems."

For a graph whose edges have no direction, a path that starts at a vertex, uses every edge exactly once, and returns to that vertex is called an Euler circuit.

In a connected graph, an Euler circuit exists if and only if every vertex has even degree. So a simple graph traversal is enough to check whether an Euler circuit exists. However, actually building one is a different problem. Given a connected graph that has an Euler circuit, consider how to find one.

Gu Dae-gi came up with the following algorithm, thinking "Wouldn't this build an Euler circuit?"

  1. Choose a vertex v.
  2. Repeat the following.
    1. Among the unused edges adjacent to the current vertex, choose one. If there is none, stop.
    2. Use that edge and move to the vertex on its other end.

Can this algorithm build an Euler circuit? It cannot. It can be proven that the algorithm always stops at v. In step 2-1, if the current vertex is not v, the number of unused edges is always odd, so it is greater than zero. But stopping at v does not mean every edge has been used.

Look at the graph above. If v is vertex 1, the walk may visit vertices 1, 4, 2, 6, 1 in that order and fail to build an Euler circuit. If v is vertex 2, however, an Euler circuit is always built no matter which edges are chosen in step 2-1.

Find every vertex from which this algorithm may fail to build an Euler circuit, and show Gu Dae-gi that his idea was wrong.

Input

The first line contains the number of vertices NN and the number of edges MM (1≤N,M≤200,0001 \le N, M \le 200{,}000).

Each of the next MM lines contains the two endpoints of an edge. Every number is between 1 and NN, inclusive.

The graph is simple. No edge connects a vertex to itself, and no two edges connect the same pair of vertices. The graph is connected, and an Euler circuit is guaranteed to exist.

Output

On the first line, print the number of vertices from which the algorithm may fail to build an Euler circuit. On the next line, print all such vertex numbers in ascending order.

Examples1

  1. Example 1

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