#include <bits/stdc++.h>
using namespace std;
struct graph {
  struct point {
    int next, to;
  } ar[200050];
  int head[200050], art = 1;
  inline void link(int u, int v) {
    ar[++art] = {head[u], v}, head[u] = art;
    ar[++art] = {head[v], u}, head[v] = art;
  }
  inline void link1(int u, int v) { ar[++art] = {head[u], v}, head[u] = art; }
} G, G1, G2;
bool is[200050];
int dfn[200050], low[200050], tim, a2[200050], sta[200050], top, a[200050],
    a1[200050], rt[200050], a3[200050], dep[200050], dp[200050][17], a4[200050];
inline bool dfs(int, int);
inline int lca(int, int);
inline void read(int&), tarjan(int), prepare(), Min(int&, int), dfs1(int),
    dfs2(int);
int main() {
  int n, m;
  read(n), read(m), prepare();
  for (int i(1), u, v; i <= m; ++i) read(u), read(v), G.link(u, v);
  for (int i(1); i <= n; ++i)
    if (!rt[i]) rt[i] = i, dfs1(i);
  for (int i(1); i <= n; ++i)
    if (!dfn[i]) top = 0, tarjan(i);
  tim = 0;
  for (int i(1); i <= n; ++i)
    if (rt[i] == i) dfs2(i);
  for (int i, j(1); j < 17; ++j)
    for (i = 1; i + (1 << j) - 1 <= tim; ++i)
      dp[i][j] = dep[dp[i][j - 1]] < dep[dp[i + (1 << j - 1)][j - 1]]
                     ? dp[i][j - 1]
                     : dp[i + (1 << j - 1)][j - 1];
  int Q;
  read(Q);
  for (int i(1), u, v; i <= Q; ++i)
    if (read(u), read(v), rt[u] ^ rt[v])
      puts("No");
    else if (dep[u] & 1 ^ dep[v] & 1)
      puts("Yes");
    else
      puts(a3[u] + a3[v] - (a3[lca(u, v)] << 1) ? "Yes" : "No");
  return 0;
}
inline int lca(int x, int y) {
  x = a[x], y = a[y];
  if (x > y) x ^= y ^= x ^= y;
  int len(a4[y - x + 1]);
  return dep[dp[x][len]] < dep[dp[y - (1 << len) + 1][len]]
             ? dp[x][len]
             : dp[y - (1 << len) + 1][len];
}
inline void prepare() {
  for (int i(0); 1 << i < 200050; ++i) a4[1 << i] = i;
  for (int i(1); i < 200050; ++i) a4[i] = a4[i] ? a4[i] : a4[i - 1];
}
inline void dfs2(int x) {
  dp[a[x] = ++tim][0] = x;
  for (int i(G2.head[x]), i1; i; i = G2.ar[i].next)
    a3[i1 = G2.ar[i].to] += a3[dp[++tim][0] = x], dfs2(i1);
}
inline void dfs1(int x) {
  for (int i(G.head[x]), i1; i; i = G.ar[i].next)
    if (!rt[i1 = G.ar[i].to])
      G2.link1(x, i1), dep[i1] = dep[x] + 1, a2[i] = a2[i ^ 1] = i1,
                       rt[i1] = rt[x], dfs1(i1);
}
inline bool dfs(int x, int c) {
  a1[x] = c;
  for (int i(G1.head[x]), i1; i; i = G1.ar[i].next)
    if (!~a1[i1 = G1.ar[i].to] && dfs(i1, c ^ 1))
      return true;
    else if (a1[i1] == c)
      return true;
  return false;
}
inline void Min(int& x, int y) { x = x < y ? x : y; }
inline void tarjan(int x) {
  dfn[x] = low[x] = ++tim, sta[++top] = x;
  for (int i(G.head[x]), j, k, i1, i2; i; i = G.ar[i].next)
    if (!dfn[i1 = G.ar[i].to]) {
      tarjan(i1), Min(low[x], low[i1]);
      if (dfn[x] <= low[i1]) {
        int at(0);
        G1.art = 1;
        do G1.head[a[++at] = sta[top]] = 0, is[a[at]] = 1;
        while (sta[top--] ^ i1);
        G1.head[x] = 0, is[x] = 1;
        for (j = 1; j <= at; ++j)
          for (k = G.head[a[j]]; k; k = G.ar[k].next)
            if (is[i2 = G.ar[k].to]) {
              if (i2 == x)
                G1.link(x, a[j]);
              else if (i2 < a[j])
                G1.link(i2, a[j]);
            }
        for (j = 1; j <= at; ++j) a1[a[j]] = -1;
        a1[x] = -1;
        if (dfs(a[1], 0))
          for (j = 1; j <= at; ++j)
            for (k = G.head[a[j]]; k; k = G.ar[k].next)
              if (is[G.ar[k].to] && a2[k]) ++a3[a2[k]], a2[k] = a2[k ^ 1] = 0;
        for (j = 1; j <= at; ++j) is[a[j]] = 0;
        is[x] = 0;
      }
    } else
      Min(low[x], dfn[i1]);
}
inline void read(int& x) {
  x ^= x;
  register char c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
}
