Олимпиадный тренинг

Задача 38844. One Way


Задача

Темы: Обход в глубину
In a city built during the Middle Ages, the width of the streets began to impede the movement of traffic, which was originally two-way on each of the streets. To solve this problem, it was proposed to make traffic on each of the streets one-way. The mayor entrusted this task to his first deputy. After much thought, he reported that on some streets the traffic would have to be left two-way, otherwise it would be impossible to drive from anywhere in the city to any other. According to the given scheme of the city, it is required to find all such streets.

Input
The first line of the input file contains the numbers N - the number of squares in the city and M - the number of streets connecting them (1 <= N <= 20000, 1 <= M <= 200000). The squares are numbered from 1 to N. Each of the next M lines contains a pair of natural numbers describing between which two squares the corresponding street passes (two squares are connected by at most one street).

Imprint
On the first line print the number B - the number of streets on which it is impossible to organize one-way traffic. On the next line print B integers - the numbers of these streets in ascending order. Streets are numbered starting from one in the order in which they are given in the input file.

 
 
Examples
# Input Output
1 10 16
26
37
6 5
5 9
5 4
1 2
98
6 4
2 10
38
79
14
24
10 5
16
6 10
1
4