#graph201. 割边

割边

Bridge Edges

Problem Description

You are given an undirected connected graph with nn vertices and mm edges. Output all bridge edges (cut edges) in increasing order of their index. Note: the edges are numbered starting from 11.

(A bridge / cut edge is an edge whose removal increases the number of connected components.)

Input Format

The first line contains two integers n,mn, m (1≤n≤105, 1≤m≤2×1051 \leq n \leq 10^5,\ 1 \leq m \leq 2 \times 10^5).

The next mm lines each contain two integers u,vu, v, indicating an undirected edge. There are no self-loops, but there may be multiple edges.

Output Format

First output one integer: the number of bridge edges. Then on the next line, output the indices of the bridge edges in increasing order, separated by spaces.

Sample Input

7 8
1 2
2 3
3 4
2 5
4 5
5 6
5 7
5 7

Sample Output

2
1 6

Constraints

  • 1≤n≤1051 \leq n \leq 10^5
  • 1≤m≤2×1051 \leq m \leq 2 \times 10^5
  • No self-loops; multiple edges may exist