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