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
#include <algorithm>
#include <iostream>
#include <unordered_set>
#include <vector>

using namespace std;

bool solve(long long start, vector<pair<int, int>> &commands) {
	unordered_set<long long> s;
	s.insert(start);
	
	for (auto &[a, b] : commands) {
		unordered_set<long long> s2;
		for (auto &it : s) {
			if (!((it & (1 << a)) > 0 && (it & (1 << b)) == 0)) {
				if (s2.count(it))
					s2.erase(it);
				else
					s2.insert(it);
				if ((it & (1 << a)) == 0 && (it & (1 << b)) > 0) {
					long long swapped = it;
					swapped |= (1 << a);
					swapped &= ~(1 << b);
					if (s2.count(swapped))
						s2.erase(swapped);
					else
						s2.insert(swapped);
				}
			}
		}
		s = s2;
	}

	return s.size() & 1;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int n, m;
	cin >> n >> m;
	vector<pair<int, int>> commands(m);
	for (int i = 0; i < m; i++) {
		cin >> commands[i].first >> commands[i].second;
		--commands[i].first;
		--commands[i].second;
	}
	reverse(commands.begin(), commands.end());

	for (int k = 1; k <= n; k++) {
		int sum{};
		for (int i = 0; i <= n - k; i++) {
			long long num{};
			for (int j = 0; j < k; j++) {
				num |= (1 << (i + j));
			}
            sum += solve(num, commands);
		}
		cout << sum % 2 << ' ';
	}

	return 0;	
}