func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( O2 )   using namespace std;   const int maxn = 1e5 + 10, lg = 18;   int n, m, q, cid[maxn], csize = 0, H[maxn], low[maxn], ok[maxn], par[maxn][lg],                           comp[maxn], c1;   bool dp[maxn][lg];   vector<int> G[maxn];   bool mark[maxn];   void dfs1(int a, int p) {     par[a][0] = p;     for (int i = 1; i < lg; i++) {       par[a][i] = par[par[a][i - 1]][i - 1];     }     low[a] = H[a];     mark[a] = 1;     for (int b : G[a]) {       if (!mark[b]) {         H[b] = H[a] + 1;         comp[b] = comp[a];         dfs1(b, a);         low[a] = min(low[a], low[b]);       } else if (b != p) {         low[a] = min(low[a], H[b]);       }     }   }   void dfs2(int a) {     mark[a] = 1;     for (int b : G[a]) {       if (!mark[b]) {         if (low[b] >= H[a]) {           cid[b] = csize++;         } else {           cid[b] = cid[a];         }         dfs2(b);       } else if (H[a] > H[b]) {         int dis = H[a] - H[b];         if ((dis & 1) == 0) {           ok[cid[a]] = 1;         }       }     }   }   void dfs3(int a) {     mark[a] = 1;     dp[a][0] = (ok[cid[a]]);     for (int b : G[a]) {       if (!mark[b]) {         dfs3(b);       }     }   }   bool lca(int a, int b) {     bool ans = 0;     if (H[a] > H[b]) swap(a, b);     for (int i = lg - 1; i >= 0; i--) {       if (H[par[b][i]] >= H[a]) {         ans |= dp[b][i];         b = par[b][i];       }     }     if (a == b) {       return ans;     }     for (int i = lg - 1; i >= 0; i--) {       if (par[b][i] != par[a][i]) {         ans |= dp[a][i];         ans |= dp[b][i];         a = par[a][i];         b = par[b][i];       }     }     ans |= dp[a][0];     ans |= dp[b][0];     return ans;   }   int32_t main() {     scanf( %d%d , &n, &m);     for (int i = 0; i < m; i++) {       int a, b;       scanf( %d%d , &a, &b);       a--, b--;       G[a].push_back(b);       G[b].push_back(a);     }     for (int i = 0; i < n; i++) {       if (!mark[i]) {         comp[i] = c1++;         dfs1(i, i);       }     }     fill(mark, mark + n, 0);     for (int i = 0; i < n; i++) {       if (!mark[i]) {         cid[i] = csize++;         dfs2(i);       }     }     fill(mark, mark + n, 0);     for (int i = 0; i < n; i++) {       if (!mark[i]) {         dfs3(i);       }     }     for (int j = 0; j < lg - 1; j++) {       for (int i = 0; i < n; i++) {         dp[i][j + 1] = dp[i][j] | dp[par[i][j]][j];       }     }     scanf( %d , &q);     while (q--) {       int a, b;       scanf( %d%d , &a, &b);       a--, b--;       if (H[a] > H[b]) swap(a, b);       if (a == b || comp[a] != comp[b]) {         printf( No n );         continue;       }       if ((H[b] - H[a]) & 1) {         printf( Yes n );         continue;       }       bool ans = lca(a, b);       printf(ans ?  Yes n  :  No n );     }   }   