对于一棵树,定义点的距离为二者的最短路径长度,可以有
树的直径的端点为(L,R)
对于任意一点u,L或R为距离u最远的点。
证明:
https://atcoder.jp/contests/abc267/editorial/4753