poj2021. idea of union-find-set. Good~