Function to find diameter of the tree for storing max two depth child
int dfsDiameter ( int a , int par , int & diameter ) { int x = 0 , y = 0 ; for ( int i g [ a ] ) { if ( i == par ) continue ; int mx = dfsDiameter ( i , a , diameter ) ;