#include <bits/stdc++.h>
using namespace std;
const int Inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fll;
struct DSU {
  int fa[1 << 17];
  DSU() {
    for (int i = 0; i < (1 << 17); i++) fa[i] = i;
  }
  int inline root(int x) { return fa[x] == x ? x : (fa[x] = root(fa[x])); }
} dsu;
int n, m, q;
vector<int> nei[1 << 17];
int ceng[1 << 17];
int fa[20][1 << 17];
int hv[1 << 17], qzh[1 << 17];
void inline dfs(int now) {
  ceng[now] = ceng[fa[0][now]] + 1;
  for (__typeof((nei[now]).begin()) i = (nei[now]).begin(),
                                    _e_D_ = (nei[now]).end();
       i != _e_D_; i++) {
    if (!ceng[*i]) {
      fa[0][*i] = now;
      dfs(*i);
      if (dsu.root(*i) == dsu.root(now)) hv[now] |= hv[*i];
    } else if (ceng[*i] + 1 < ceng[now]) {
      if (!((ceng[now] ^ ceng[*i]) & 1)) hv[now] = 1;
      for (int j = dsu.root(now); ceng[j] > ceng[*i] + 1; j = dsu.root(j))
        dsu.fa[j] = fa[0][j];
    }
  }
}
void inline dfs2(int now) {
  qzh[now] += hv[now];
  for (__typeof((nei[now]).begin()) i = (nei[now]).begin(),
                                    _e_D_ = (nei[now]).end();
       i != _e_D_; i++)
    if (ceng[*i] == ceng[now] + 1) {
      if (dsu.root(*i) == dsu.root(now)) hv[*i] |= hv[now];
      qzh[*i] = qzh[now];
      dfs2(*i);
    }
}
int inline lca(int a, int b) {
  if (ceng[a] > ceng[b]) swap(a, b);
  int toup = ceng[b] - ceng[a];
  while (toup) b = fa[__builtin_ctz(toup)][b], toup &= (toup - 1);
  if (a == b) return a;
  for (int i = (19); ((-1) > 0 ? i <= (0) : i >= (0)); i += (-1))
    if (fa[i][a] != fa[i][b]) a = fa[i][a], b = fa[i][b];
  return fa[0][a];
}
bool inline query(int a, int b) {
  int c = lca(a, b);
  if (!c) return 0;
  if ((ceng[a] ^ ceng[b]) & 1)
    return 1;
  else
    return qzh[a] + qzh[b] - 2 * qzh[c];
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= (m); i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    nei[a].push_back(b);
    nei[b].push_back(a);
  }
  for (int i = 1; i <= (n); i++)
    if (!ceng[i]) dfs(i), dfs2(i);
  for (int i = 1; i <= (19); i++)
    for (int j = 1; j <= (n); j++) fa[i][j] = fa[i - 1][fa[i - 1][j]];
  scanf("%d", &q);
  while (q--) {
    int a, b;
    scanf("%d%d", &a, &b);
    puts(query(a, b) ? "Yes" : "No");
  }
  return 0;
}
