Validated unionfind