assigning level to nodes
void leveling ( int src ) { for ( int i = 0 ; i < sz ( g [ src ] ) ; i ++ ) { int des = g [ src ] [ i ] ; if ( ! level [ des ] ) { level [ des ] = level [ src ] + 1 ; leveling ( des ) ; } } } bool visited [ maxn ] ;