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
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#include<bits/stdc++.h>
 
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("trapv")
 
#define st first
#define nd second
#define pb push_back
#define pp pop_back
#define eb emplace_back
#define mp(a, b) make_pair(a, b)
#define all(x) (x).begin(), (x).end()
#define rev(x) reverse(all(x))
#define sor(x) sort(all(x))
#define sz(x) (int)(x).size()
#define rsz(x) resize(x)
 
using namespace std;
 
///~~~~~~~~~~~~~~~~~~~~~~~~~~
 
template <typename H, typename T> 
ostream& operator<<(ostream& os, pair<H, T> m){
	return os <<"("<< m.st<<", "<<m.nd<<")";
}
template <typename H> 
ostream& operator<<(ostream& os, vector<H> V){
	os<<"{";
	for(int i=0; i<V.size(); i++){
		if(i)os<<" ";
		os<<V[i];
	}
	os<<"}";
	return os;
}
 
void debug(){cerr<<"\n";}
template <typename H, typename... T>
void debug(H h, T... t) {cerr<<h; if (sizeof...(t)) cerr << ", "; debug(t...);}
#define deb(x...) cerr<<#x<<" = ";debug(x);
 
///~~~~~~~~~~~~~~~~~~~~~~~~~
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii > vii;
typedef vector<ll> vl;
typedef vector<pll> vll;
typedef string str;
 
#define BOOST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
 
const int N=100, INF=1e9+5, mod=1e9+7;

int r[N];
vector<ll> V[N];
int find(int v){
	if(r[v]==v)return v;
	return r[v]=find(r[v]);
}
void napraw(int v){
	sort(all(V[v]));
	vector<ll> V2;
	for(int i=1; i<=V[v].size(); i++){
		if(i==V[v].size() || V[v][i]!=V[v][i-1]){
			V2.pb(V[v][i-1]);
		}
		else i++;
	}
	V[v]=V2;
}
void add(int a, int b){
	int aa=find(a), bb=find(b);
	if(aa==bb){
		ll co=(1ll<<a)+(1ll<<b);
		for(ll &i:V[aa]){
			if((i&(1ll<<a)) && !(i&(1ll<<b))){
				i^=co;
			}
		}
		if(!(rng()%20))
			napraw(aa);
	}
	else{
		napraw(aa);
		napraw(bb);
		vector<ll> V2;
		r[bb]=aa;
		ll co=(1ll<<a)+(1ll<<b);
		for(ll &i:V[aa]){
			for(ll &j:V[bb]){
				if((i&(1ll<<a)) && !(j&(1ll<<b))){
					V2.pb(i^j^co);
				}
				else V2.pb(i^j);
			}
		}
		sort(all(V2));
		V[aa]=V2;
		V[bb].clear();
		napraw(aa);
	
	//deb(V2);
	//assert(V2.size()<40e5);
	//n=2 -> 2
	//n=3 -> 4
	//n=4 -> 6
	//n=5 maksimum to 12
	//22
	//44
	//86
	//130
	//assert(V[aa].size()<=130);
	}
}
int main(){
	//BOOST;
	int n, mm;
	cin>>n>>mm;
	for(int i=0; i<n; i++){
		r[i]=i;
		V[i]={0, 1ll<<i};
	}
	for(int i=0; i<mm; i++){
		int a, b;
		cin>>a>>b;
		add(a-1, b-1);
	}
	for(int j=0; j<n; j++){
		if(r[j]==j){
			napraw(j);
			//deb(V[j]);
		}
	}	
	for(int k=0; k<n; k++){
		int ile=0;
		for(int i=0; i+k<n; i++){
			ll co=0, co2=0;
			bool b=1;
			for(int j=i; j<=i+k; j++){
				co+=(1ll<<j);
			}
			//deb(co);
			for(int j=0; j<n; j++){
				if(r[j]==j){
					ll m=-1;
					for(ll ii:V[j]){
						if(ii>m && (ii&co)==ii)m=ii;
					}
					//deb(m);
					if(m==-1)b=0;
					else co2^=m;
				}
			}
			if(co2!=co)b=0;
			if(b)ile^=1;
		}
		cout<<ile<<" ";
	}
}