union-find problem and percolation