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
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define PB push_back
typedef long long ll;
typedef long double ld;
#define REP(x,y) for(int x=0;x<(y);x++)
#define ROF(x,y) for(int x=(y);x>=0;x--)
#define FOR(x,z,y) for(int x=(z);x<=(y);x++)
#define INT(x) int x;scanf("%d",&x)
#define LL(x) ll x;scanf("%lld",&x)
#define CZ(x) char x;scanf(" %c",&x)
typedef pair<int,int> pii;
typedef pair<int,pii> piii;

pii t[1005];
int m;
unordered_set<bitset<35> > s[2];

int check(bitset<35> mask){
    int src = 0,dest = 1;
    s[src].clear();
    s[src].insert(mask);
    REP(i,m){
        s[dest].clear();
        for(auto mask:s[src]){
            if(mask[t[i].f] == mask[t[i].s]){
                s[dest].insert(mask);
            }
            else if(!mask[t[i].f] && mask[t[i].s]){
                //cout << t[i].f << " " << t[i].s << " " << mask << " " << mask[t[i].f] << " " << mask[t[i].s] << endl;
                s[dest].insert(mask);
                mask.flip(t[i].f);
                mask.flip(t[i].s);
                s[dest].insert(mask);
            }
        }
        swap(src,dest);
    }
    return s[src].size();
}

int main(){
    INT(n); scanf("%d",&m);
    ROF(i,m-1){
        INT(a); INT(b);
        t[i] = {a-1,b-1};
    }
    printf("%d ",n%2);
    FOR(i,2,n-1){
        int res = 0;
        bitset<35> mask((1L<<i)-1L);
        while(1){
            res = (res + check(mask)) %2;
            if(mask[n-1])break;
            mask<<=1;
        }
        printf("%d ",res%2);
    }
    puts("1");
}