#include <iostream>
using namespace std;
#include <bits/stdc++.h>
int main( ) {
// your code goes here
int n,m;
cin >> n>> m;
vector< int > b[ n+ 5 ] ;
int i= 1 ;
for ( i= 1 ; i<= m; i++ )
{
int x,y;
cin >> x>> y;
b[ x] .push_back ( y) ;
b[ y] .push_back ( x) ;
}
int source = 1 ;
int used[ n+ 5 ] = { 0 } ;
int level[ n+ 5 ] = { - 1 } ;
queue< int > q;
q.push ( source) ;
used[ source] = 1 ;
level[ source] = 0 ;
while ( ! q.empty ( ) )
{
int removed;
removed= q.front ( ) ;
q.pop ( ) ;
for ( auto x: b[ removed] )
{
if ( used[ x] == 0 )
{
q.push ( x) ;
used[ x] = 1 ;
level[ x] = level[ removed] + 1 ;
}
}
}
i= 1 ;
while ( i<= n)
{
if ( used[ i] == 0 )
{
cout << "you cannot reach node " << i<< " to source node " << source<< endl;
}
else
{
cout << "you can reach node " << i<< " to source node " << source<< endl;
}
//cout<<i<<"-"<<level[i]<<endl;
i++ ;
}
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwojaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KCmludCBtYWluKCkgewoJLy8geW91ciBjb2RlIGdvZXMgaGVyZQoJaW50IG4sbTsKCWNpbj4+bj4+bTsKCXZlY3RvcjxpbnQ+YltuKzVdOwoJaW50IGk9MTsKCWZvcihpPTE7aTw9bTtpKyspCgkgewoJIAlpbnQgeCx5OwoJIAljaW4+Png+Pnk7CgkgCWJbeF0ucHVzaF9iYWNrKHkpOwoJIAliW3ldLnB1c2hfYmFjayh4KTsKCSB9CgkgCgkgaW50IHNvdXJjZSA9IDE7CgkgaW50IHVzZWRbbis1XT17MH07CgkgaW50IGxldmVsW24rNV09ey0xfTsKCSBxdWV1ZTxpbnQ+cTsKCSBxLnB1c2goc291cmNlKTsKCSB1c2VkW3NvdXJjZV09MTsKCSBsZXZlbFtzb3VyY2VdPTA7CgkgCgkgd2hpbGUoI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