Generic union-find AKA disjoint-set in C