you give tree n node numerate 0 n1 for k 0 n inclusive count number unordere pair uv u neq v MEX node label short path u v include end point kThe MEX sequence integer smallest nonnegative integer belong sequence