{"raw_statement":[{"iden":"problem statement","content":"You are given an undirected graph $G$ with $N$ vertices and $M$ edges. For $i = 1, 2, \\ldots, M$, the $i$\\-th edge is an undirected edge connecting vertices $u_i$ and $v_i$.\nA graph with $N$ vertices is called **good** if the following condition holds for all $i = 1, 2, \\ldots, K$:\n\n*   there is no path connecting vertices $x_i$ and $y_i$ in $G$.\n\nThe given graph $G$ is good.\nYou are given $Q$ independent questions. Answer all of them. For $i = 1, 2, \\ldots, Q$, the $i$\\-th question is as follows.\n\n*   Is the graph $G^{(i)}$ obtained by adding an undirected edge connecting vertices $p_i$ and $q_i$ to the given graph $G$ good?"},{"iden":"constraints","content":"*   $2 \\leq N \\leq 2 \\times 10^5$\n*   $0 \\leq M \\leq 2 \\times10^5$\n*   $1 \\leq u_i, v_i \\leq N$\n*   $1 \\leq K \\leq 2 \\times 10^5$\n*   $1 \\leq x_i, y_i \\leq N$\n*   $x_i \\neq y_i$\n*   $i \\neq j \\implies \\lbrace x_i, y_i \\rbrace \\neq \\lbrace x_j, y_j \\rbrace$\n*   For all $i = 1, 2, \\ldots, K$, there is no path connecting vertices $x_i$ and $y_i$.\n*   $1 \\leq Q \\leq 2 \\times 10^5$\n*   $1 \\leq p_i, q_i \\leq N$\n*   $p_i \\neq q_i$\n*   All input values are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $M$\n$u_1$ $v_1$\n$u_2$ $v_2$\n$\\vdots$\n$u_M$ $v_M$\n$K$\n$x_1$ $y_1$\n$x_2$ $y_2$\n$\\vdots$\n$x_K$ $y_K$\n$Q$\n$p_1$ $q_1$\n$p_2$ $q_2$\n$\\vdots$\n$p_Q$ $q_Q$"},{"iden":"sample input 1","content":"6 6\n1 2\n2 3\n2 3\n3 1\n5 4\n5 5\n3\n1 5\n2 6\n4 3\n4\n2 5\n2 6\n5 6\n5 4"},{"iden":"sample output 1","content":"No\nNo\nYes\nYes\n\n*   For the first question, the graph $G^{(1)}$ is not good because it has a path $1 \\rightarrow 2 \\rightarrow 5$ connecting vertices $x_1 = 1$ and $y_1 = 5$. Therefore, print `No`.\n*   For the second question, the graph $G^{(2)}$ is not good because it has a path $2 \\rightarrow 6$ connecting vertices $x_2 = 2$ and $y_2 = 6$. Therefore, print `No`.\n*   For the third question, the graph $G^{(3)}$ is good. Therefore, print `Yes`.\n*   For the fourth question, the graph $G^{(4)}$ is good. Therefore, print `Yes`.\n\nAs seen in this sample input, note that the given graph $G$ may have self-loops or multi-edges."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}