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
#include <bits/stdc++.h>
using namespace std;
 
#define fwd(i, a, n) for (int i = (a); i < (n); i ++)
#define rep(i, n) fwd(i, 0, n)
#define all(X) begin(X), end(X)
#define sz(X) ((int)X.size())
#define st first
#define nd second
#define pii pair<int, int>
#define vi vector<int>
#define ll long long
 
#ifdef LOC
auto &operator<<(auto &out, pair<auto, auto> a) {
	return out << "(" << a.st << ", " << a.nd << ")";
}
 
auto &operator<<(auto &out, auto a) {
	out << "{";
	for (auto b : a)
		out << b << ", ";
	return out << "}";
}
 
void dump(auto... x) { ((cerr << x << ", "), ...) << '\n'; }
#define debug(x...) cerr << __LINE__ << ": [" #x "]: ", dump(x)
#else
#define debug(...) 0
#endif

int magic(int x, int a, int b){
    if((x & (1<<a)) && !(x & (1<<b))){
        //debug(x, a, b);
        x += (1<<b) - (1<<a);
        //debug(x);
    }
    return x;
}
 
int32_t main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
    int n, m; cin>>n>>m;
    vector<int> val((1<<n));
    vector<int> cnt((1<<n), 0);
    rep(i, (1<<n))val[i] = i;
    rep(j, m){
        int a, b; cin>>a>>b;
        a--; b--;
        //debug(a, b);
        rep(i, (1<<n))val[i] = magic(val[i], a, b);
    }
    rep(i, (1<<n))cnt[val[i]]++;
    //debug(val);
    //debug(cnt);
    vector<int> res(n+1, 0);
    for(int k = 1; k <= n; k++){
        int x = (1<<k) - 1;
        //debug(k, x);
        rep(i, n-k + 1){
            //debug((x<<i));
            res[k] += cnt[(x<<i)];
        }
    }
    //debug(res);
    for(int k = 1; k <= n; k++){
        cout<<(res[k] & 1)<<" ";
    }
    cout<<"\n";
	return 0;
}