Function to find diameter of the tree for storing max two depth child
def dfsDiameter ( a , par ) : NEW_LINE INDENT global N , v , g , vis , In , low , parent , rnk , bridges , n , m , timer , diameter NEW_LINE x , y = 0 , 0 NEW_LINE for i in range ( len ( g [ a ] ) ) : NEW_LINE INDENT if g [ a ] [ i ] == par : NEW_LINE continue NEW_LINE mx = dfsDiameter ( g [ a ] [ i ] , a ) NEW_LINE DEDENT DEDENT