Under construction

Still being built. Things may change

Delete Two Vertices Again

Time limit6sMemory limit512 MB

Summary
For each edge of a connected graph, decide whether deleting both of its endpoints leaves the remaining graph connected, and print a binary string.
Level

Hard8 of 10

Topics
DFS, Graph, Tree
Solved
No attempts yet

Problem

Several years ago, the same author proposed the following problem for a school competition: delete two adjacent vertices from a given connected undirected graph with min-degree at least 22 so that the graph stays connected. That problem is too simple for a student competition in 2020, so here is a harder version.

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

The graph may contain vertices of degree 11, but it has no vertices of degree 00, because it is connected and has at least 33 vertices.

Input

The first line contains two integers nn and mm (3≤n≤3⋅1053 \leq n \leq 3 \cdot 10^5, n−1≤m≤3⋅105n - 1 \leq m \leq 3 \cdot 10^5), the number of vertices and the number of edges. The ii-th of the following mm lines contains two space-separated integers xx and yy, the endpoints of the ii-th edge (1≤x,y≤n1 \leq x, y \leq n, x≠yx \neq y). The graph is connected and has no multiple edges.

Output

Print a binary string of length mm. The ii-th character is "0" if deleting the endpoints of the ii-th edge disconnects the graph, and "1" otherwise.

Hint

Note that both endpoints of the edge are deleted, not only the edge itself. So this task is different from finding bridges.

For example, in the sample, edge 11-22 is not a bridge, but deleting vertices 11 and 22 disconnects the graph. The remaining graph consists of two isolated vertices, 33 and 44. On the other hand, edge 11-44 is a bridge, but deleting vertices 11 and 44 leaves the graph connected. The remaining vertices 22 and 33 are joined by edge 22-33.

Examples1

  1. Example 1

    Input
    4 4
    1 2
    2 3
    3 1
    4 1
    
    Expected output
    0101