dfs function to find the sum of distance of leaves outside the subtree
def dfs2 ( a , par ) : NEW_LINE INDENT for i in v [ a ] : NEW_LINE INDENT if ( i [ 0 ] == par ) : NEW_LINE INDENT continue NEW_LINE DEDENT DEDENT DEDENT