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