So I was looking at this problem, and I was wondering why we couldn’t just keep track of cycles and the nodes that lead into them, as the intended solution involves binary lifting or something like that.
Well, did you figure out the answer? It seems possible (but not simpler) to do this without binary lifting, assuming online queries.
I… forgot. I think it was too complicated, involving doing a check to see if a node had any node leading to it and starting at all those nodes, leading me to give up.