[Ruby] UnionFind木の実装 https://hai3.net/blog/ruby-union-find-tree/