Find the root of the group containing the element at index x
def find ( x ) : NEW_LINE INDENT if x == root [ x ] : NEW_LINE INDENT return x NEW_LINE DEDENT else : NEW_LINE INDENT root [ x ] = find ( root [ x ] ) NEW_LINE return root [ x ] NEW_LINE DEDENT DEDENT