Tarjan's Least Common Ancestors Algorithm