import sys read=sys.stdin.buffer.read readline=sys.stdin.buffer.readline readlines=sys.stdin.buffer.readlines class UnionFind: def __init__(self, n): self.n=n self.par=[-1]*n def find(self, x): if self.par[x]<0: return x self.par[x]=self.find(self.par[x]) return self.par[x] def unite(self, x, y): x=self.find(x) y=self.find(y) if x==y: return False if self.par[x]