We have graph $$$G$$$ and 4 types of queries:
- Add/Remove set of direct edges $$$(uv)$$$.
- Mark vertex $$$v$$$.
- Check for some vertex $$$v$$$ if there is a path from marked vertex $$$u$$$ to $$$v$$$.
$$$N \leq 100000, M \leq 1000000, queries \leq 1000$$$. Should be better $$$O(N^2)$$$, online.
There are no more than $$$1000$$$ edges in $$$1$$$ query
I have no idea how to solve this, any hint?