primitive LCA
update LCA and DAG loop