#include <bits/stdc++.h>
using namespace std;
const int inf = ~0U >> 1;
const long long INF = ~0LLU >> 1;
int rd() { return RAND_MAX == 32767 ? ((rand() << 15) ^ rand()) : rand(); }
const int maxn = 100010;
const int maxq = 100010;
int p[maxn], q[maxn], fa[maxn], dep[maxn], odd[maxn], sum[maxn];
int lca[maxq];
vector<int> G[maxn];
vector<pair<int, int> > E, G_[maxn];
int Find(int *p, int x) { return p[x] == x ? x : p[x] = Find(p, p[x]); }
void Dfs(int t) {
  for (__typeof(G[t].begin()) e = G[t].begin(); e != G[t].end(); e++)
    if (dep[*e] == -1) {
      dep[*e] = dep[t] + 1;
      fa[*e] = t;
      Dfs(*e);
      q[*e] = t;
      if (Find(p, *e) == Find(p, t)) odd[t] |= odd[*e];
    } else if (dep[t] > dep[*e] + 1) {
      if ((dep[t] - dep[*e]) % 2 == 0) odd[t] = 1;
      for (int k = Find(p, t); dep[k] > dep[*e] + 1; k = Find(p, k))
        p[k] = fa[k];
    }
  for (__typeof(G_[t].begin()) e = G_[t].begin(); e != G_[t].end(); e++)
    if (dep[(*e).first] != -1) lca[(*e).second] = Find(q, (*e).first);
}
void Calc(int t) {
  sum[t] += odd[t];
  for (__typeof(G[t].begin()) e = G[t].begin(); e != G[t].end(); e++)
    if (dep[*e] == dep[t] + 1) {
      if (Find(p, *e) == Find(p, t)) odd[*e] |= odd[t];
      sum[*e] = sum[t];
      Calc(*e);
    }
}
int main() {
  int n, m, T;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  cin >> T;
  for (int i = 0; i < T; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    G_[u].push_back(make_pair(v, i));
    G_[v].push_back(make_pair(u, i));
    E.push_back(make_pair(u, v));
  }
  memset(dep, -1, sizeof(dep));
  memset(odd, 0, sizeof(odd));
  for (int i = 0; i < n; i++) p[i] = q[i] = i;
  for (int i = 0; i < n; i++)
    if (dep[i] == -1) {
      fa[i] = -1;
      dep[i] = 0;
      Dfs(i);
      sum[i] = 0;
      Calc(i);
    }
  for (int i = 0; i < T; i++) {
    int u = E[i].first, v = E[i].second, w = lca[i];
    if (u != v && Find(q, u) == Find(q, v) &&
        (abs(dep[u] - dep[v]) % 2 == 1 || sum[u] + sum[v] - sum[w] * 2 > 0))
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
