first mockup of unionfind and merge function