Find the ancestor of two nodes