#include <bits/stdc++.h>
namespace IO {
char buf[1000000], *p1, *p2;
inline char getc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <typename tp>
inline void r(tp &n) {
  n = 0;
  char c = getc();
  while (!isdigit(c)) c = getc();
  while (isdigit(c)) n = n * 10 + c - 48, c = getc();
}
template <typename tp>
inline void w(tp n) {
  if (n / 10) w(n / 10);
  putchar(n % 10 + 48);
}
};  // namespace IO
using namespace IO;
const int N = 1e5 + 5, M = 1e5 + 5;
using namespace std;
int n, m, q, num, tot, top;
int dep[N], dis[N], dfn[N], low[N], col[N], stk[N], odd[N], cur[N], f[N][21];
int head[N], nt[M << 1], to[M << 1];
void Add(int x, int y) {
  ++num;
  nt[num] = head[x];
  head[x] = num;
  to[num] = y;
  ++num;
  nt[num] = head[y];
  head[y] = num;
  to[num] = x;
}
int ins[N];
void Tar(int p, int fa) {
  col[p] = col[fa];
  dep[p] = dep[fa] + 1;
  dfn[p] = low[p] = ++tot;
  stk[++top] = p;
  ins[p] = 1;
  for (int i = head[p]; i; i = nt[i])
    if (to[i] ^ fa) {
      int v = to[i];
      if (!dfn[v]) {
        f[v][0] = p;
        for (int i = 1; i <= 20; ++i) f[v][i] = f[f[v][i - 1]][i - 1];
        Tar(v, p);
        low[p] = min(low[p], low[v]);
      } else if (ins[v])
        low[p] = min(low[p], dfn[v]), cur[p] |= (!(dep[p] + dep[v] & 1));
    }
  if (dfn[p] == low[p]) {
    int flg = 0, t = top;
    while (stk[t] != p && !flg) flg = cur[stk[t]], --t;
    while (stk[top] != p) {
      odd[stk[top]] |= flg;
      ins[stk[top]] = 0;
      --top;
    }
    --top, ins[p] = 0;
  }
}
void DFS(int p) {
  dis[p] += odd[p];
  for (int i = head[p]; i; i = nt[i])
    if (dep[to[i]] == dep[p] + 1) dis[to[i]] = dis[p], DFS(to[i]);
}
int LCA(int x, int y) {
  if (dep[x] < dep[y]) x ^= y ^= x ^= y;
  for (int i = 20; i >= 0; --i)
    if (dep[f[x][i]] >= dep[y]) x = f[x][i];
  if (x == y) return x;
  for (int i = 20; i >= 0; --i)
    if (f[x][i] != f[y][i]) x = f[x][i], y = f[y][i];
  return f[x][0];
}
int DIS(int x, int y) { return dis[x] + dis[y] - 2 * dis[LCA(x, y)]; }
bool check(int x, int y) {
  if (col[x] != col[y] || x == y) return false;
  if (dep[x] + dep[y] & 1) return true;
  return DIS(x, y) > 0;
}
int main() {
  r(n), r(m);
  for (int i = 1, x, y; i <= m; ++i) r(x), r(y), Add(x, y);
  for (int i = 1; i <= n; ++i)
    if (!dfn[i]) col[i] = i, Tar(i, i), DFS(i);
  r(q);
  for (int i = 1, x, y; i <= q; ++i)
    r(x), r(y), puts(check(x, y) ? "Yes" : "No");
  return 0;
}
