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
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#include <cstdio>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <bitset>
#include <stack>
#include <string>
#include <cstring>
#include <cassert>
#include <limits.h>

using namespace std;

typedef unsigned long long LL;
typedef long double LD;

typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(VAR(i,a);i<=(b);++i)
#define FORD(i,a,b) for(VAR(i,a);i>=(b);--i)
#define FORE(a,b) for(VAR(a,(b).begin());a!=(b).end();++a)
#define VAR(a,b) __typeof(b) a=(b)
#define SIZE(a) ((int)((a).size()))
#define ALL(x) (x).begin(),(x).end()
#define CLR(x,a) memset(x,a,sizeof(x))
#define ZERO(x) memset(x,0,sizeof(x))
#define S(t,i) scanf("%" ## t, &i)
#define SI(i) scanf("%d", &i)

const int MAXN=1000+5;
typedef unsigned long long BS;

int n, m;
LL r[MAXN][2];
BS rx[MAXN];
unordered_set<BS> s;
// set<BS> s;
LL p[] = {1ULL, 2ULL, 4ULL, 8ULL, 16ULL, 32ULL, 64ULL, 128ULL, 256ULL, 512ULL, 1024ULL, 2048ULL, 4096ULL, 8192ULL, 16384ULL, 32768ULL, 65536ULL, 131072ULL, 262144ULL, 524288ULL, 1048576ULL, 2097152ULL, 4194304ULL, 8388608ULL, 16777216ULL, 33554432ULL, 67108864ULL, 134217728ULL, 268435456ULL, 536870912ULL, 1073741824ULL, 2147483648ULL, 4294967296ULL, 8589934592ULL, 17179869184ULL, 34359738368ULL, 68719476736ULL};

inline void set_set(BS &s, int i) {
    s |= p[i];
}

void print_BS(BS s) {
    FORD(i, 63, 0) {
        printf("%d", (s & (1ULL<<i)) == 0 ? 0 : 1);
    }
    printf("\n");
}

// BS to_del[10000000];
// BS to_add[10000000];
// int tdi;
// int tai;

vector<BS> to_del;
vector<BS> to_add;

int solve(BS cs) {
    s.clear();
    s.insert(cs);
    FORD(i, m-1, 0) {
        to_add.clear();
        to_del.clear();
        // tdi=0;
        // tai=0;

        FORE(si, s) {
            cs = *si;
            bool first = cs & r[i][0];
            bool second = cs & r[i][1];
            if (first == second) {
                to_add.push_back(cs);
            } else if (!first && second) {
                to_add.push_back(cs);
                to_add.push_back(cs ^ rx[i]);
            } else {
                to_del.push_back(cs);
            }
            // if (first == second) {
            //     to_add[tai++] = cs;
            // } else if (!first && second) {
            //     to_add[tai++] = cs;
            //     to_add[tai++] = cs ^ rx[i];
            // } else {
            //     to_del[tdi++] = cs;
            // }
        }
        // REP(ti, tdi) {
        //     s[s_curr].erase(to_del[ti]);
        // }
        // REP(ti, tai) {
        //     s[s_curr].insert(to_add[ti]);
        // }
        FORE(m, to_del) {
            s.erase(*m);
        }
        FORE(m, to_add) {
            s.insert(*m);
        }
    }
    return s.size() & 1;
}

int main() {
    ios_base::sync_with_stdio(0);

    SI(n);
    SI(m);
    REP(i, m) {
        int r0, r1;
        SI(r0);
        SI(r1);
        r0--;
        r1--;
        r[i][0] = p[r0];
        r[i][1] = p[r1];
        rx[i] = r[i][0] | r[i][1];
    }


    // BS tt=0;
    // set_set(tt, 0);
    // set_set(tt, 8);
    // simulate_ref(tt);
    // return 0;

    printf("%d ", n & 1);

    FOR(ik, 2, n-1) {
        int result = 0;
        BS cs = 0;
        REP(i, ik){
            set_set(cs, i);
        }
        result += solve(cs);
        REP(i, n-ik) {
            cs <<= 1;
            result += solve(cs);
        }
        printf("%d ", result & 1);
    }

    printf("1");

    return 0;
}