the max distance of binary tree