525. Revolutionary Roads

Time limit per test: 1 second(s)
Memory limit: 262144 kilobytes
input: standard
output: standard

Governments of different countries like to boast about their achievements. For instance, the President of Flatland has announced that his country has the most advanced road system. He said the degree of a country road system development is equal to the amount of cities in the largest subset of cities. A subset of cities is called if it is possible to get from any city of the subset to all other cities of the subset.

Not to lag behind the neighbors Berland's President decided to undertake a reform and modernize roads in his country. All the roads in Berland are one-way, each of them connects a pair of cities in one direction. There is at most one road in each direction between any two given cities.

Since there is little money in the budget, President's plans aren't very ambitious. He can turn at most one of all given one-way roads into a two-way road. And he wants to do it in such a way that the resulting road system degree of development in Berland becomes as high as possible. Let's say the maximum degree of development, which can be achieved by this action, is equal to w.

A road is called if, after it is changed from one-way to two-way, the degree of road system development becomes equal to w. Your task is to find all roads.

Input
The first line of input contains a pair of numbers n, m (1 ≤ n ≤ 1000, 0 ≤ m ≤ 20000), where n — the number cities, m — the number of roads. The following m lines contain descriptions of the roads. Each line contains a pair of integers ai, bi (1 ≤ ai, bin, aibi), representing a one-way road from city ai to city bi. Cities are numbered from 1 to n.

Output
Write w to the first line of output. To the second line write t — number of roads in the required subset. To the third line write indices of the roads in this subset. Roads are numbered from 1 to m according to their order in the input file.

Example(s)
sample input
sample output
5 4
1 2
2 3
1 3
4 1
3
1
3 

sample input
sample output
3 4
1 2
2 1
1 3
3 1
3
4
1 2 3 4 




Online Contester Team © 2002 - 2010. All rights reserved.