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
166
167
168
#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;
int inf=1000000007;
ll infl=1000000000000000007;
ll mod=1000000007;
ll mod1=998244353;

const int N=40;

int npok[N][N];

int col[N];
int k;

int ans[N];

int ile[N][N][N];
int ile1[N];

vector<pair<int,int>>E;
int n,m;

void bt(int i)
{
	//cout<<"XD "<<i<<endl;
	//for(int j=1;j<=n;j++) cout<<col[j]<<" ";
	//cout<<endl;
	if(i==m)
	{
		int l=inf,r=-inf;
		for(int j=1;j<=n;j++)
		{
			//cout<<col[j]<<" ";
			if(col[j]==2)
			{
				if(l==inf) l=j;
				r=j;
			}
		}
		//cout<<endl;
		if(l==inf)
		{
			int c=0;
			for(int j=1;j<=n;j++)
			{
				if(col[j]==0) c++;
				else 
				{
					ile1[c]++;
					c=0;
				}
			}
			ile1[c]++;
			return ;
		}
		for(int j=1;j<=n;j++)
		{
			if(col[j]==1&&j>l&&j<r) return ;
		}
		int X=0,Y=0;
		while(l-X-1>0&&col[l-X-1]==0) X++;
		while(r+Y+1<=n&&col[r+Y+1]==0) Y++;
		ile[r-l+1][X][Y]++;
		return ;
	}
	int a=E[i].st,b=E[i].nd;
	int X=col[a],Y=col[b];
	//cout<<a<<" "<<b<<" "<<X<<" "<<Y<<endl;
	if(X==0&&Y==0)
	{
		//??
		col[a]=1;
		col[b]=1;
		bt(i+1);
		col[a]=2;
		col[b]=2;
		k+=2;
		bt(i+1);
		k-=2;
	}
	else if(X>0&&Y>0)
	{
		if(X==2&&Y==1)
		{
			col[a]=1;
			col[b]=2;
		}
		bt(i+1);
	}
	else if(X>0)
	{
		if(X==2)
		{
			col[a]=0;
			col[b]=2;
		}
		bt(i+1);
	}
	else
	{
		if(Y==1)
		{
			col[b]=0;
			col[a]=1;
		}
		bt(i+1);
	}
	col[a]=X,col[b]=Y;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>m;
    E.resize(m);
    for(int i=0;i<m;i++) cin>>E[i].st>>E[i].nd;
    bt(0);
    for(int i=1;i<=n;i++)
    {
		ile1[i]%=2;
		if(!ile1[i]) continue;
		for(int j=1;j<=i;j++) ans[j]^=(i-j+1)%2;
	}
	for(int k=1;k<=n;k++)
	{
		for(int X=0;X<=n;X++)
		{
			for(int Y=0;Y<=n;Y++)
			{
				ile[k][X][Y]%=2;
				if(!ile[k][X][Y]) continue;
				for(int j=k;j<=k+X+Y;j++)
				{
					for(int l=0;l<=X;l++)
					{
						if(l+k+Y>=j&&l+k<=j) ans[j]^=1;
					}
				}
			}
		}
	}
    
    for(int i=1;i<=n;i++) cout<<ans[i]<<" ";
    cout<<endl;
    
  
    return 0;
}
/*
4 1
4 1
* 
4 3
4 1
1 2
3 4
*/