Add Tarjan's offline LCA algorithm