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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <bits/stdc++.h>
#define FOR(i,p,k) for(int i=(p);i<=(k);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define ssize(x) (int((x).size()))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define gc getchar_unlocked
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

void wczytaj(int &a){
	int c = gc();
	while(c < '0' || c > '9') c = gc();
	for(a = 0; c >= '0' && c <= '9'; c = gc()) a = 10*a+c-'0';
}

int n, m;
vector<pii> wej;
vector<int> wyn;
void nawroty(int pref, ll zero, ll jeden){
	if(pref == m){
		int maks1 = -1;
		REP(i, n) if(jeden>>i&1ll) maks1 = i;
		REP(poc, n){
			FOR(kon, poc, n-1){
				if(zero>>kon&1ll) break;
				if(kon >= maks1) ++wyn[kon-poc+1];
			}
			if(jeden>>poc&1ll) break;
		}
		return;
	}
	auto [a, b] = wej[pref];
	if(zero>>a&1ll || jeden>>b&1ll) return nawroty(pref+1, zero, jeden);
	if(jeden>>a&1ll || zero>>b&1ll){
		if((zero>>a&1ll) != (zero>>b&1ll)) zero ^= (1ll<<a)^(1ll<<b);
		if((jeden>>a&1ll) != (jeden>>b&1ll)) jeden ^= (1ll<<a)^(1ll<<b);
		return nawroty(pref+1, zero, jeden);
	}
	nawroty(pref+1, zero^(1ll<<a)^(1ll<<b), jeden);
	nawroty(pref+1, zero, jeden^(1ll<<a)^(1ll<<b));
}

void solve(){
	wczytaj(n), wczytaj(m);
	wej.resize(m);
	for(auto &[a, b] : wej) wczytaj(a), wczytaj(b), --a, --b;
	wyn.resize(n+1, 0);
	nawroty(0, 0ll, 0ll);
	FOR(i, 1, n) printf("%d ", wyn[i]&1);
}

int main(){
	solve();
	return 0;
}