Greedy thought consideration: For chains with a length greater than 1, one node must be deleted, which will be better.
We found that for each node, there are at most log200000 different gcds, so the record vis[u][pd][now] means: after traversing 1 to u node, whether a point has been deleted, and the current gcd is now. Has it ever appeared. Memory search.