belong=list() group=list() def init(X): global belong global group belong=list(range(X)) group=[[i] for i in range(X)] def unite(x,y): if len(group[belong[x]])