AT_past202209_k 連結チェック
Description
There is an undirected graph with $ N $ vertices and $ M $ edges. Initially, the $ i $ -th edge connects Vertex $ a_i $ and Vertex $ b_i $ .
Process $ Q $ queries. The $ i $ -th query is represented by $ t_i $ , $ x_i $ , and $ y_i $ as follows.
- If $ t_i=1 $ , add an edge connecting Vertex $ x_i $ and Vertex $ y_i $ . There are at most $ 10 $ queries of this kind in a single test case.
- If $ t_i=2 $ , delete the edge connecting Vertex $ x_i $ and Vertex $ y_i $ .
- If $ t_i=3 $ , print `Yes` if Vertex $ x_i $ and Vertex $ y_i $ belong to the same connected component, and `No` otherwise.
Input Format
Input is given from Standard Input in the following format:
> $ N $ $ M $ $ a_1 $ $ b_1 $ $ \vdots $ $ a_M $ $ b_M $ $ Q $ $ t_1 $ $ x_1 $ $ y_1 $ $ \vdots $ $ t_Q $ $ x_Q $ $ y_Q $
Output Format
For each query such that $ t_i=3 $ , print the answer and then a newline.
Explanation/Hint
### Sample Explanation 2
There may be no query such that $ t_i=3 $ .
### Constraints
- $ 1 \leq N,M,Q \leq 10^5 $
- $ 1 \leq a_i \lt b_i \leq N $
- $ (a_i,b_i) \neq (a_j,b_j) $ if $ i \neq j $ .
- $ t_i \in \{ 1,2,3 \} $
- $ 1 \leq x_i \lt y_i \leq N $
- There are at most $ 10 $ indices $ i $ such that $ t_i=1 $ .
- If $ t_i=1 $ , there is no edge connecting Vertex $ x_i $ and Vertex $ y_i $ when the query is given.
- If $ t_i=2 $ , there is an edge connecting Vertex $ x_i $ and Vertex $ y_i $ when the query is given.
- All values in input are integers.