How to solve [this](https://www.codechef.com/FEB17/problems/DISTNUM3) problem?↵
↵
Statement: GivenN$N$ nodes of a tree, answer Q$Q$ queries of 2$2$ types(update value of some node or find the number of distinct numbers on the path from U$U$ to V$V$).↵
↵
There is a solution with Mo's algorithm with updates and I don't understand that as well. Can anyone explain any other approach or even this one?
↵
Statement: Given
↵
There is a solution with Mo's algorithm with updates and I don't understand that as well. Can anyone explain any other approach or even this one?