core ideas:
HLD works because heavy chains create contiguous segments in a linear array
The light-edge bound ensures we don't visit too many chains
Any path operation (max, sum, min, gcd) works if the segment tree supports it
Path updates (add to all nodes on path) need lazy propagation in the segment tree HLD is the standard technique for tree path queries. Learn it well, you'll use it often.