Added naive lca algorithm for one-off queries.