Function to perform th Get operation of disjoint set union
def Get ( graph , a ) : NEW_LINE INDENT if graph [ graph [ a ] ] != graph [ a ] : NEW_LINE INDENT graph [ a ] = Get ( graph , graph [ a ] ) NEW_LINE DEDENT else : NEW_LINE INDENT return graph [ a ] NEW_LINE DEDENT DEDENT