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
#include <bits/stdc++.h>
#include <bits/extc++.h>
#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,fma,abm,mmx,avx,avx2,tune=native")
#pragma GCC target("sse,sse2,abm,mmx,sse3,tune=native")
using namespace std;
using namespace __gnu_pbds;
typedef long long lld;
typedef pair<int, int> pii;
typedef pair<lld, lld> pll;
#define ff first
#define dd second
#define mp make_pair
#define pb push_back
#define sz size()
#define For(i, s, a) for(int i = s; i < a; ++i)
#define all(x) (x).begin(), (x).end()
#define make_unique(x) (x).erase(unique(all(x)), (x).end())

vector<pii> c;


int testuj(lld mask, int m) {
    bool a_ready = mask & (1ll << c[m - 1].ff);
    bool b_ready = mask & (1ll << c[m - 1].dd);
    
    if (a_ready && !b_ready) {
        return 0;
    }

    if (!a_ready && b_ready) {
        if (m == 1) {
            return 0;
        }

        lld mask_step = mask ^ (1ll << c[m - 1].ff) ^ (1ll << c[m - 1].dd);
        int wyn = 0;
        wyn ^= testuj(mask_step, m - 1);
        wyn ^= testuj(mask, m - 1);
        return wyn;
    }

    if (m == 1) {
        return 1;
    }

    int wyn = testuj(mask, m - 1);
    return wyn;
}

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    c.resize(m);
    For (i, 0, m) {
        scanf("%d%d", &c[i].ff, &c[i].dd);
        --c[i].ff;
        --c[i].dd;
    }
    For (i, 1, n + 1) {
        lld mask = 0;
        For (mm, 0, i)
            mask |= (1ll << mm);
        int ans = testuj(mask, m);
        //cout << mask << " testing " << i << endl;
        For (mm, 0, n - i) {
            mask ^= (1ll << mm);
            mask ^= (1ll << (mm + i));
            //cout << mask << " testing " << i << endl;
            ans ^= testuj(mask, m);
        }
        printf("%d ", ans);
    }
    puts("");
}