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

using namespace std;

typedef long long LL;
int n, m, a[1000], b[1000];

int ile(LL w, int mm)
{
    if (mm<0)
        return 1;
    int aa=a[mm], bb=b[mm];
    if (w&(1LL<<aa))
        return (w&(1LL<<bb)) ? ile(w, mm-1) : 0;
    if ((w&(1LL<<bb))==0)
        return ile(w, mm-1);

    LL w2=w^((1LL<<aa)|(1LL<<bb));
    return (ile(w, mm-1) + ile(w2, mm-1))%2;
}

int main()
{
    ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);

    cin>>n>>m;
    for (int i=0; i<m; ++i)
    {
        cin>>a[i]>>b[i];
        --a[i];
        --b[i];
    }

    for (int k=1; k<=n; ++k)
    {
        int wyn=0;
        for (int pocz=0; pocz+k<n+1; ++pocz)
        {
            LL w=0;
            for (int i=0; i<k; ++i)
                w|=(1LL<<(pocz+i));
            wyn+=ile(w, m-1);
        }
        cout<<(wyn%2)<<' ';
    }

    return 0;
}