you give unweighted tree n vertex then n1 follow operation apply tree a single operation consist follow step choose leave add length simple path answer remove choose leave tree initial answer apply operation 0 obviously n1 operation tree consist single vertex calculate maximal possible answer achieve construct sequence operation allow achieve answer