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
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
void add(unordered_set<long long>&a, long long x)
{
	auto it = a.find(x);
	if (it != a.end()) a.erase(it);
	else a.insert(x);
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, m; cin>>n>>m;
	vector<int>a(m), b(m);
	for (int i=0; i<m; i++)
	{
		cin>>a[i]>>b[i];
		a[i]--; b[i]--;
	}
	for (int k=1; k<=n; k++)
	{
		unordered_set<long long>dp;
		//~ cout<<k<<endl;
		long long msk=(1ll<<k)-1;
		for (int i=0; i<=n-k; i++, msk<<=1) dp.insert(msk);
		for (int i=m-1; i>=0; i--)
		{
			//~ cout<<k<<" "<<i<<" "<<dp.size()<<endl;
			unordered_set<long long>pom;
			for (auto j : dp)
			{
				//~ cout<<" "<<bitset<4>(j);
				if (!(j&(1ll<<a[i])))
				{
					add(pom, j);
					if (j&(1ll<<b[i])) add(pom, j-(1ll<<b[i])+(1ll<<a[i]));
				}
				else if ((j&(1ll<<a[i])) && (j&(1ll<<b[i]))) add(pom, j);
			}
			//~ cout<<endl;
			swap(dp, pom);
		}
		cout<<(dp.size()&1)<<" ";
	}
	cout<<"\n";
}