Delete Two Vertices Again

아직 제출이 없습니다시간 제한6초메모리 제한512 MB

문제

Several years ago, the same author has proposed the following problem for a school competition: delete two adjacent vertices from a given connected undirected graph with min-degree at least 22 in a way that preserves connectivity. But that problem is too simple for a student competition in 2020, so here we go.

You are given a connected undirected graph with at least 33 vertices and without self-loops and multiple edges. For each edge, determine whether deleting both its endpoints preserves connectivity of the graph. 

Notice that, in this problem, the graph may contain vertices of degree 11, but not vertices of degree 00 (since it is connected and has at least 33 vertices).

입력

The first line of the input contains two integers nn and mm (3n31053 \leq n \leq 3 \cdot 10^5; n1m3105n - 1 \leq m \leq 3 \cdot 10^5): the number of vertices and the number of edges correspondingly. The ii-th of the following mm lines contains two space-separated integers xx and yy: the endpoints of the ii-th edge (1x,yn1 \leq x, y \leq n; xyx \neq y). It is guaranteed that the graph is connected and does not contain multiple edges.

출력

Output a single binary string of length mm: ii-th character of the answer should be "0" (without quotes) if deleting endpoints of the ii-th edge makes the graph disconnected and "1" otherwise.

힌트

Please notice that not only the edge itself is deleted, both its endpoints are too. Therefore, the task in question is different from finding bridges. 

For example, in the sample, the edge 11--22 is not a bridge, but deleting vertices 11 and 22 makes the graph disconnected: the resulting graph consists of two isolated vertices 33 and 44

On the other hand, the edge 11--44 is a bridge, but deleting vertices 11 and 44 makes the graph connected: the resulting graph consists of two vertices 22 and 33, connected by the edge 22--33.