If K is even Try to find an edge such that weight of edge i -> j and j -> i is equal
found = 0 NEW_LINE idx1 = None NEW_LINE idx2 = None NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT for j in range ( 1 , n + 1 ) : NEW_LINE INDENT if ( i == j ) : NEW_LINE INDENT continue NEW_LINE DEDENT if ( adj [ i ] [ j ] == adj [ j ] [ i ] ) : NEW_LINE DEDENT DEDENT