#include <bits/stdc++.h>
using namespace std;
namespace FGF {
int n, m;
const int N = 5e5 + 5;
struct edg {
  int to, nxt, id;
} e[N << 1];
int cnt = 1, head[N], s;
int rt[N], dfn[N], low[N], st[N], bel[N], col[N], num, tp, dcc, siz[N], sum[N],
    dep[N], fa[N][20];
bool vis[N], is[N], fl;
vector<int> V[N], E[N];
void add(int u, int v, int id) {
  cnt++;
  e[cnt].to = v;
  e[cnt].nxt = head[u];
  head[u] = cnt;
  e[cnt].id = id;
}
void tarjan(int u, int f) {
  dfn[u] = low[u] = ++num;
  dep[u] = dep[e[f ^ 1].to] + 1, fa[u][0] = e[f ^ 1].to,
  rt[u] = rt[e[f ^ 1].to];
  for (int i = 1; i <= 18; i++) fa[u][i] = fa[fa[u][i - 1]][i - 1];
  for (int i = head[u]; i; i = e[i].nxt) {
    int v = e[i].to;
    if (vis[i] || i == (f ^ 1)) continue;
    st[++tp] = i;
    if (!dfn[v]) {
      tarjan(v, i);
      low[u] = min(low[u], low[v]);
      if (low[v] >= dfn[u]) {
        ++dcc;
        int x = -1;
        V[dcc].push_back(u);
        do {
          x = st[tp--];
          bel[x] = bel[x ^ 1] = dcc;
          vis[x] = vis[x ^ 1] = 1;
          V[dcc].push_back(e[x].to);
          E[dcc].push_back(x);
        } while (x != i);
      }
    } else
      low[u] = min(low[u], dfn[v]);
  }
}
bool dfs2(const int u, const int from) {
  if (vis[u]) {
    if (col[u] == col[e[from ^ 1].to])
      return true;
    else
      return false;
  }
  vis[u] = true, col[u] = (col[e[from ^ 1].to] ^ 1);
  for (int i = head[u]; i; i = e[i].nxt) {
    int v = e[i].to;
    if (bel[i] != bel[from] || i == (from ^ 1)) continue;
    if (dfs2(v, i)) return true;
  }
  return false;
}
void dfs(const int u, const int from) {
  vis[u] = true;
  for (int i = head[u]; i; i = e[i].nxt) {
    int v = e[i].to;
    if (vis[v] || i == (from ^ 1)) continue;
    sum[v] = sum[u] + is[i];
    dfs(v, i);
  }
}
int getlca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  int d = dep[u] - dep[v];
  for (int i = 18; i >= 0; i--)
    if (d & (1 << i)) u = fa[u][i];
  if (u == v) return u;
  for (int i = 18; i >= 0; i--)
    if (fa[u][i] != fa[v][i]) u = fa[u][i], v = fa[v][i];
  return fa[u][0];
}
void work() {
  scanf("%d%d", &n, &m);
  int u, v;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &u, &v);
    add(u, v, i), add(v, u, i);
  }
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) rt[0] = i, tarjan(i, 0);
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= dcc; i++) {
    for (int sz = V[i].size(), j = 0; j < sz; j++) vis[V[i][j]] = 0;
    if (dfs2(e[E[i][0]].to, E[i][0]))
      for (int sz = E[i].size(), j = 0; j < sz; j++)
        is[E[i][j]] = is[E[i][j] ^ 1] = 1;
  }
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= n; i++)
    if (!vis[i]) dfs(i, 0);
  int Q;
  scanf("%d", &Q);
  while (Q--) {
    scanf("%d%d", &u, &v);
    if (rt[u] != rt[v])
      puts("No");
    else {
      int lca = getlca(u, v);
      if ((dep[u] + dep[v] - 2 * dep[lca]) & 1)
        puts("Yes");
      else if (sum[u] + sum[v] - 2 * sum[lca])
        puts("Yes");
      else
        puts("No");
    }
  }
}
}  // namespace FGF
int main() {
  FGF::work();
  return 0;
}
