Weighted QuickUnion for union_find