Weighted Union-Find.