input: [0] Common Ancestor [1] Child [2] Grandchild [3] Great Grandchild [4] Great Great Grandchild [5] Great Great Great Grandchild [6] Great Great Great Great Grandchild [8] Great Great Great Great Great Great Grandchild [7] 
output: Great Great Great Great Great Grandchild