#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005, maxm = 400005;
struct edge {
  int to, next;
} e[maxm * 2];
int h[maxn], tot;
int n, m, q;
struct Edge {
  int u, v;
  bool operator<(const Edge &a) const { return u != a.u ? u < a.u : v < a.v; }
};
stack<Edge> S;
vector<Edge> bcc_e[maxn];
map<Edge, int> odd;
inline void add(int u, int v) {
  e[++tot] = (edge){v, h[u]};
  h[u] = tot;
}
int Time, dfn[maxn], low[maxn], bcc_cnt, bccno[maxn];
vector<int> bcc[maxn];
bool iscut[maxn];
void tarjan(int u, int fa) {
  dfn[u] = low[u] = ++Time;
  int child = 0;
  for (int i = h[u]; i; i = e[i].next) {
    int v = e[i].to;
    Edge E = (Edge){u, v};
    if (!dfn[v]) {
      S.push(E);
      ++child;
      tarjan(v, u);
      low[u] = min(low[u], low[v]);
      if (low[v] >= dfn[u]) {
        iscut[u] = true;
        bcc_cnt++;
        for (;;) {
          Edge x = S.top();
          S.pop();
          bcc_e[bcc_cnt].push_back(x);
          if (bccno[x.u] != bcc_cnt)
            bcc[bcc_cnt].push_back(x.u), bccno[x.u] = bcc_cnt;
          if (bccno[x.v] != bcc_cnt)
            bcc[bcc_cnt].push_back(x.v), bccno[x.v] = bcc_cnt;
          if (x.u == u && x.v == v) break;
        }
      }
    } else if (dfn[v] < dfn[u] && v != fa) {
      S.push(E);
      low[u] = min(low[u], dfn[v]);
    }
  }
  if (fa == 0 && child == 1) iscut[u] = false;
}
void find_bcc() {
  for (int i = 1; i <= n; ++i)
    if (!dfn[i]) tarjan(i, 0);
}
int now, col[maxn];
bool color(int u) {
  for (int i = h[u]; i; i = e[i].next) {
    int v = e[i].to;
    if (bccno[v] != now) continue;
    if (col[v] == col[u]) return false;
    if (!col[v]) {
      col[v] = 3 - col[u];
      if (!color(v)) return false;
    }
  }
  return true;
}
void color_bcc() {
  fill(bccno + 1, bccno + n + 1, 0);
  for (int i = 1; i <= bcc_cnt; ++i) {
    for (int v : bcc[i]) bccno[v] = i;
    int u = bcc[i][0];
    col[u] = 1;
    now = i;
    if (!color(u))
      for (Edge E : bcc_e[i]) odd[E] = true;
    for (int v : bcc[i]) col[v] = 0;
  }
}
int ufs[maxn], U[maxn], V[maxn];
int find(int x) {
  if (ufs[x] == 0) return x;
  return ufs[x] = find(ufs[x]);
}
bool merge(int u, int v) {
  int x = find(u), y = find(v);
  if (x == y) return false;
  ufs[x] = y;
  return true;
}
void build_tree() {
  for (int i = 1, j = 1; i < n; ++i) {
    while (j <= m && !merge(U[j], V[j])) ++j;
    if (j > m) break;
    add(U[j], V[j]);
    add(V[j], U[j]);
  }
}
int logn = 1;
int deep[maxn], f[maxn][20], unv[maxn][20];
int flag[maxn];
void dfs(int u, int fa) {
  flag[u] = now;
  f[u][0] = fa;
  deep[u] = deep[fa] + 1;
  for (int i = h[u], v; i; i = e[i].next) {
    v = e[i].to;
    if (v == fa) continue;
    unv[v][0] = odd.count((Edge){u, v}) | odd.count((Edge){v, u});
    dfs(v, u);
  }
}
void get_fa() {
  for (int &j = logn; (1 << j) <= n; ++j)
    for (int i = 1; i <= n; ++i)
      f[i][j] = f[f[i][j - 1]][j - 1],
      unv[i][j] = unv[i][j - 1] | unv[f[i][j - 1]][j - 1];
}
bool lca(int u, int v) {
  if (deep[u] > deep[v]) swap(u, v);
  int ans = 0, p = deep[v] - deep[u], len = 0;
  for (int i = 0; (1 << i) <= n; ++i)
    if (p & (1 << i)) ans |= unv[v][i], v = f[v][i], len += (1 << i);
  if (u == v) return ans || (len & 1);
  for (int i = logn; i >= 0; --i)
    if (f[u][i] != f[v][i]) {
      ans |= unv[v][i] | unv[u][i];
      u = f[u][i];
      v = f[v][i];
      len += (1 << i) << 1;
    }
  ans |= unv[v][0] | unv[u][0];
  len += 2;
  return ans || (len & 1);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &U[i], &V[i]);
    add(U[i], V[i]);
    add(V[i], U[i]);
  }
  find_bcc();
  color_bcc();
  fill(h + 1, h + n + 1, 0);
  tot = 0;
  build_tree();
  now = 0;
  for (int i = 1; i <= n; ++i)
    if (!flag[i]) ++now, dfs(i, 0);
  get_fa();
  scanf("%d", &q);
  for (int x, y, i = 1; i <= q; ++i) {
    scanf("%d%d", &x, &y);
    if (flag[x] == flag[y] && lca(x, y))
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
