#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
const int N = 200020;
int dp[N][23], dep[N], fa[N];
int dfn[N], low[N], bel[N], tim, ret;
int st[N], top;
int odd[N];
int s[N];
int n, m;
vector<int> e[N];
inline void init_st(int u, int f) {
  dep[u] = dep[f] + 1;
  for (int i = 1; i <= 22; i++) {
    dp[u][i] = dp[dp[u][i - 1]][i - 1];
  }
  for (int v : e[u]) {
    if (!dep[v]) {
      fa[v] = fa[u];
      dp[v][0] = u;
      init_st(v, u);
    }
  }
}
inline void tarjan(int u, int f) {
  dfn[u] = low[u] = ++tim;
  st[++top] = u;
  for (int v : e[u]) {
    if (v == f) continue;
    if (!dfn[v]) {
      tarjan(v, u);
      low[u] = min(low[v], low[u]);
    } else
      low[u] = min(low[u], dfn[v]);
  }
  if (low[u] == dfn[u]) {
    ++ret;
    int v;
    do {
      v = st[top--];
      bel[v] = ret;
    } while (u != v);
  }
}
inline void check(int u) {
  for (int v : e[u]) {
    if (((dep[u] + dep[v]) % 2 == 0) && bel[u] == bel[v]) {
      odd[bel[u]] = 1;
      return;
    }
  }
}
inline void dfs(int u) {
  for (int v : e[u]) {
    if (dep[v] == dep[u] + 1) {
      s[v] += s[u];
      dfs(v);
    }
  }
}
inline int lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  int delta = dep[x] - dep[y];
  for (int i = 0; i <= 22; i++) {
    if (delta & (1 << i)) {
      x = dp[x][i];
    }
  }
  if (x == y) return x;
  for (int i = 22; i >= 0; i--) {
    if (dp[x][i] != dp[y][i]) {
      x = dp[x][i];
      y = dp[y][i];
    }
  }
  return dp[x][0];
}
inline int qwq(int u, int v) {
  if (fa[u] != fa[v] || u == v ||
      (!((dep[u] + dep[v]) % 2) && s[u] + s[v] == 2 * s[lca(u, v)]))
    return 0;
  return 1;
}
signed main() {
  n = read(), m = read();
  for (int i = 1; i <= m; i++) {
    int u = read(), v = read();
    e[u].push_back(v);
    e[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (!dep[i]) {
      fa[i] = i;
      init_st(i, 0);
    }
  }
  for (int i = 1; i <= n; i++) {
    if (dep[i] == 1) {
      tarjan(i, 0);
    }
  }
  for (int u = 1; u <= n; u++) {
    if (!odd[bel[u]]) {
      check(u);
    }
  }
  for (int i = 1; i <= n; i++) {
    if (dp[i][0] && bel[i] == bel[dp[i][0]] && odd[bel[i]]) {
      s[i]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (dep[i] == 1) dfs(i);
  }
  int q = read();
  for (int i = 1; i <= q; i++) {
    int u = read(), v = read();
    if (qwq(u, v))
      puts("Yes");
    else
      puts("No");
  }
}
