poj 1330 Nearest Common Ancestors