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
//泥の分際で私だけの大切を奪おうだなん
#include<bits/stdc++.h>
#define ll long long
using namespace std;
inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
int n=read(),m=read();
int u[1003],v[1003],a[43],ans[43];
void dfs(int x)
{
	if(x>m)
	{
		int one=0;
		for(int i=1; i<=n; ++i) one+=(a[i]==1);
		for(int l=1; l<=n; ++l)
			for(int r=l,t=0; r<=n&&a[r]!=0; ++r)
				t+=(a[r]==1),(t==one)&&(ans[r-l+1]^=1);
		return ;
	}
	if(a[u[x]]==-1&&a[v[x]]==-1)
		a[u[x]]=a[v[x]]=0,dfs(x+1),
		a[u[x]]=a[v[x]]=1,dfs(x+1),
		a[u[x]]=a[v[x]]=-1;
	else if(a[v[x]]==1) dfs(x+1);
	else if(a[u[x]]==0) dfs(x+1);
	else swap(a[u[x]],a[v[x]]),dfs(x+1),
		swap(a[u[x]],a[v[x]]);
}
signed main()
{
	for(int i=1; i<=n; ++i) a[i]=-1;
	for(int i=1; i<=m; ++i) u[i]=read(),v[i]=read();
	dfs(1);
	for(int i=1; i<=n; ++i) printf("%d ",ans[i]);
	puts("");
	return 0;
}