New Island

No attempts yetTime limit1sMemory limit128 MB

Problem

A new island has been discovered. A team of architects designed a road plan that connects the island's important places, but the budget is too small to build all of it, so the plan must be trimmed into a cheaper one.

In the proposed plan, every road has a distinct id between $1$ and $E$ (where $E$ is the number of roads), and the road with id $i$ costs exactly $2^i$. Because the ids are all different, the road costs are distinct powers of two.

We want to remove some roads so that the total cost of the remaining roads is as small as possible, while every place stays connected. However, roads may not be removed freely: in the reduced plan, the distance between any two places must not become more than twice their distance in the original plan. The distance between two places is the minimum number of roads on a route connecting them.

You are given the original road plan as a graph. Find the removal that minimizes the total remaining cost while respecting the distance constraint. Because the costs are distinct powers of two, this optimal removal is unique.

Input

The input contains several test cases. Each test case begins with a line containing two integers $N$ ($1 \le N \le 200$) and $E$ — the number of places (vertices) and the number of roads (edges). Each of the next $E$ lines contains two integers $v_i$ and $u_i$, meaning the road with id $i$ runs between places $v_i$ and $u_i$ (roads are numbered $1$ through $E$ in the order they are given).

The input ends with a line containing two zeros.

Output

For each test case, print a single line containing the number of removed roads, followed by the ids of the removed roads in increasing order. If no road is removed, print a single $0$.