find lowest common ancestor