naive lca implementation