Find two children with maximum heights
if ( height [ u ] >= max1 ) : NEW_LINE INDENT max2 = max1 NEW_LINE max1 = height [ u ] NEW_LINE DEDENT elif ( height [ u ] > max2 ) : NEW_LINE INDENT max2 = height [ u ] NEW_LINE DEDENT sum = 0 NEW_LINE for u in adj [ cur ] : NEW_LINE if ( u != par ) : NEW_LINE