translate
use union find