unionfind with quick find