Improved QuickUnion. Weighted and used path compression