func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<vector<pair<int, int> > > Mat;   vector<int> Grafo;   vector<int> Entrada;   vector<int> Rev;   vector<int> Aristas;   stack<int> STACK;   vector<int> Backi;   int grafos;   bool dfs(int A, int i, int pos) {     Grafo[A] = grafos;     Entrada[A] = pos;     Backi[A] = pos;     bool J = false;     for (int I = 0; I < Mat[A].size(); I++) {       if (Mat[A][I].first != i) {         if (Grafo[Mat[A][I].first] == 0) {           STACK.push(Mat[A][I].second);           bool JJ = dfs(Mat[A][I].first, A, pos + 1);           Backi[A] = min(Backi[A], Backi[Mat[A][I].first]);           if (i == -1 || (i != -1 && Backi[Mat[A][I].first] >= Entrada[A])) {             if (JJ) {               int UU = STACK.top();               STACK.pop();               while (UU != Mat[A][I].second) {                 Aristas[UU] = 1;                 UU = STACK.top();                 STACK.pop();               }               Aristas[Mat[A][I].second] = 1;             } else {               int UU = STACK.top();               STACK.pop();               while (UU != Mat[A][I].second) {                 UU = STACK.top();                 STACK.pop();               }             }           } else {             if (JJ) J = JJ;           }         } else if (Entrada[Mat[A][I].first] < Entrada[A]) {           if ((Entrada[A] - Entrada[Mat[A][I].first]) % 2 == 0) {             J = true;           }           STACK.push(Mat[A][I].second);           Backi[A] = min(Backi[A], Backi[Mat[A][I].first]);         }       }     }     return J;   }   int main() {     int N, A, B, C;     scanf( %d%d , &N, &A);     Mat.resize(N);     for (int I = 0; I < A; I++) {       scanf( %d%d , &B, &C);       B--;       C--;       Mat[B].push_back(make_pair(C, I));       Mat[C].push_back(make_pair(B, I));     }     Backi.resize(N);     Aristas.resize(A);     Grafo.resize(N);     grafos = 1;     Entrada.resize(N);     Entrada.resize(0);     Entrada.resize(N);     Rev.resize(N);     for (int I = 0; I < N; I++) {       if (Grafo[I] == 0) {         bool OO = dfs(I, -1, 0);         grafos++;       }     }     vector<int> Distancias(N);     vector<int> CC(N), Rev3(N);     int cont = 0;     int var;     for (int I = 0; I < N; I++) {       if (Rev3[I] == 0) {         cont++;         queue<int> COLA;         COLA.push(I);         Distancias[I] = 1;         CC[I] = cont;         Rev3[I] = 1;         while (!COLA.empty()) {           int KKK = COLA.front();           COLA.pop();           CC[KKK] = cont;           Rev3[KKK] = 1;           for (int I2 = 0; I2 < Mat[KKK].size(); I2++) {             var = Mat[KKK][I2].first;             if (Aristas[Mat[KKK][I2].second] == 0 && Rev3[var] == 0) {               Distancias[var] = Distancias[KKK] + 1;               COLA.push(var);               Rev3[var] = 1;             }           }         }       }     }     int MM, AA, BB;     scanf( %d , &MM);     for (int I = 0; I < MM; I++) {       scanf( %d%d , &AA, &BB);       AA--;       BB--;       if (Grafo[AA] != Grafo[BB] || AA == BB) {         printf( No n );       } else {         if (CC[AA] != CC[BB])           printf( Yes n );         else {           if ((Distancias[AA] + Distancias[BB] + 1) % 2 == 0) {             printf( Yes n );           } else             printf( No n );         }       }     }     return 0;   }   