Construct tree from pairs. Further, the pairs may appear in any order.