#include #define rep(i,n) for(int i = 0; i < (n); ++i) #define srep(i,s,t) for (int i = s; i < t; ++i) #define drep(i,n) for(int i = (n)-1; i >= 0; --i) using namespace std; typedef long long int ll; typedef pair P; #define yn {puts("Yes");}else{puts("No");} #define MAX_N 200005 vector

G[MAX_N]; int ans[MAX_N]; int use[MAX_N]; int main() { int n, m; cin >> n >> m; rep(i,m){ int a, b; cin >> a >> b; G[a].push_back(P(b,i)); G[b].push_back(P(a,i)); } drep(i,n){ queue que; rep(j,G[i].size()){ if(use[G[i][j].second] == 0){ use[G[i][j].second] = 1; if(ans[G[i][j].first] == 1) continue; que.push(G[i][j].first); ans[G[i][j].first] = 1; } } while(que.size() > 0){ int x = que.front(); que.pop(); rep(j,G[x].size()){ use[G[x][j].second] = 1; } } } int flag = 0; drep(i,n){ if(ans[i] == 1){ flag = 1; cout << ans[i]; }else if(flag){ cout << ans[i]; } } cout << endl; return 0; }