You are given an undirected graph with $$$n$$$ vertices and $$$m$$$ edges. The vertices are numbered $$$1,2,\cdots,n$$$, and the edges are numbered $$$1,2,\cdots,m$$$.
You need to choose some of these edges.
We use a 01 sequence $$$\{a_i\}_{i=1}^m$$$ to represent which edges are chosen. If the edge with index $$$i$$$ is chosen, then $$$a_i=1$$$; otherwise, $$$a_i=0$$$.
The chosen edges must satisfy the following conditions:
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$2\le n\le10^6$$$, $$$1\le m\le10^6$$$).
Each of the next $$$m$$$ lines contains two integers $$$u_i$$$ and $$$v_i$$$ ($$$1\le u_i,v_i\le n$$$), representing the edge with index $$$i$$$ that connects vertices $$$u_i$$$ and $$$v_i$$$.
It is guaranteed that there is no self-loop in the graph, i.e., $$$u_i\ne v_i$$$.
If there is no solution, output -1.
Otherwise, output a 01 sequence of length $$$m$$$ (one line with $$$m$$$ integers, separated by single spaces) representing your choice of edges.
4 41 22 33 44 1
1 0 1 0
3 21 22 3
-1
In the first example, if we do not require sequence $$$a$$$ to be lexicographically greatest, another valid solution is to choose edges numbered $$$2$$$ and $$$4$$$.