Building up the tree in the mapper.