#include using namespace std; int main() { int n, m; cin >> n >> m; vector> adj(n); for (size_t i = 0; i < m; i++) { int a, b; cin >> a >> b; adj[a].push_back(b); adj[b].push_back(a); } bool select[n] = {}; bool selected = false; for (int i = n - 1; i >= 0; i--) { if (select[i]) { selected = true; } else { for (auto to : adj[i]) { select[to] = true; } } if (selected) { cout << select[i]; } } cout << endl; }