human
Union | Naive implementation of find.
Naive implementation of union ( )"
How can the above be solved in Python?
 ... Write me a code to union and the other steps required?
assistant
#Here is code to union and the other steps required.
 def find ( parent , i ) :
	if ( parent [ i ] == - 1 ) :
		return i
	return find ( parent , parent [ i ] )
def Union ( parent , x , y ) :
	xset = find ( parent , x )
	yset = find ( parent , y )
	parent [ xset ] = yset