How do you usually implement HLD?
Do you flatten the tree by DFS (prioritizing the heavy child) and use a single segment tree over the whole array,
or build a separate segment tree for each chain?
ABC 483 problems EFG (part 2)