#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m, Q, fa[N], f[N][18];
int dep[N], S[N], fl[N];
vector<int> e[N];
int get(int x) { return x == fa[x] ? x : fa[x] = get(fa[x]); }
void dfs1(int x) {
  dep[x] = dep[f[x][0]] + 1;
  for (auto i : e[x])
    if (!dep[i]) {
      f[i][0] = x;
      dfs1(i);
      if (get(x) == get(i)) fl[x] |= fl[i];
    } else if (dep[i] + 1 < dep[x]) {
      if ((dep[i] + dep[x] + 1) & 1) fl[x] = 1;
      for (int y = get(x); dep[y] > dep[i] + 1; y = get(y)) fa[y] = f[y][0];
    }
}
void dfs2(int x) {
  S[x] += fl[x];
  for (auto i : e[x])
    if (dep[i] == dep[x] + 1) {
      if (get(x) == get(i)) fl[i] |= fl[x];
      S[i] = S[x];
      dfs2(i);
    }
}
int LCA(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  int tmp = dep[x] - dep[y];
  for (int i = (int)(16); i >= (int)(0); i--)
    if (tmp & (1 << i)) x = f[x][i];
  for (int i = (int)(16); i >= (int)(0); i--)
    if (f[x][i] != f[y][i]) x = f[x][i], y = f[y][i];
  return x == y ? x : f[x][0];
}
bool ask(int x, int y) {
  int L = LCA(x, y);
  if (!L) return 0;
  if ((dep[x] + dep[y]) & 1) return 1;
  return S[x] + S[y] - 2 * S[L];
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (int)(1); i <= (int)(m); i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    e[x].push_back(y);
    e[y].push_back(x);
  }
  for (int i = (int)(1); i <= (int)(n); i++) fa[i] = i;
  for (int i = (int)(1); i <= (int)(n); i++)
    if (!dep[i]) dfs1(i), dfs2(i);
  for (int i = (int)(1); i <= (int)(16); i++)
    for (int j = (int)(1); j <= (int)(n); j++) f[j][i] = f[f[j][i - 1]][i - 1];
  scanf("%d", &Q);
  while (Q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    puts(ask(x, y) ? "Yes" : "No");
  }
}
