balanced union find