1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <cstdio>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define INT(x) int x; scanf("%d", &x)

int a[1000], b[1000], c[1000];
bool r[36];

int main() {
	INT(n);
	INT(m);
	REP(j,m) scanf("%d%d", &a[j], &b[j]);
	REP(j,m) a[j] = 1 << (a[j] - 1);
	REP(j,m) b[j] = 1 << (b[j] - 1);
	REP(j,m) c[j] = a[j] | b[j];
	int n2 = 1 << n;
	FOR(ma,1,n2) {
		int x = ma;
		REP(j,m) if ((x & c[j]) == a[j]) x ^= c[j];
		if (!((x + (x &  ~(x - 1))) & x))
			r[__builtin_popcount(x)] ^= 1;
	}
	REP(i,n) {
		if (i) printf(" ");
		printf("%d", int(r[i + 1]));
	}
	printf("\n");
}