added tree common ancestor solution