Function to count distance
static void bfs ( int src ) { List < int > q = new List < int > ( ) ; q . Add ( src ) ; vis [ src ] = 1 ; dis [ src ] = 0 ; while ( q . Count != 0 ) { int curr = q [ 0 ] ; q . RemoveAt ( 0 ) ; foreach ( int x in lis [ curr ] ) {