Three Paths on a Tree

CodeForces - 1294F