graph
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld

题目描述

Given an undirected graph without self-loops, your task is to assign either 0 or 1 to each node. Subsequently, any edge connecting two nodes with different values will be removed. Each connected component should then have at least one Eulerian path. If there are multiple ways to assign values to the nodes, you can choose any one of them.

Eulerian path: an Eulerian trail (or Eulerian path) is a trail in a finite graph that visits every edge exactly once (allowing for revisiting vertices).

Connected component: a component of an undirected graph is a connected subgraph that is not part of any larger connected subgraph.

输入描述:

The first line contains two integers n,m (1 \leq n \leq 100, 0 \leq m \leq 10000) , representing the number of nodes and edges in the graph, respectively.

For the next m lines, each contains two integers u_i,v_i (1\leq u_i,v_i \leq n, u_i \neq v_i), which means there is an edge connecting node u_i and v_i. It is possible to have multiple edges between the same pair of nodes.

输出描述:

If it is possible to assign the values, print n values of 0 or 1 in a single line. The i-th of them represents the value assigned to the i-th node. Otherwise, print -1.

If there are multiple solutions, you can print any of them.
示例1

输入

复制
3 6
2 3
1 3
2 1
2 1
1 2
1 3

输出

复制
0 1 0