Equiv table

Replaced equiv_table dictionary with union-find data structure