the end node should be one of the leaves