#include <bits/stdc++.h>
using namespace std;
const int MAX = 200010;
vector<int> L[MAX];
struct data {
  int a, b, ans, done;
} Q[MAX];
int ara[MAX];
namespace BCT {
vector<int> ed[MAX];
bool cut[MAX];
int tot, Time, low[MAX], st[MAX];
vector<int> bcc[MAX];
stack<int> S;
void popBCC(int s, int x) {
  cut[s] = 1;
  bcc[++tot].push_back(s);
  while (bcc[tot].back() ^ x) {
    bcc[tot].push_back(S.top());
    S.pop();
  }
}
void dfs(int s, int p = -1) {
  S.push(s);
  int ch = 0;
  st[s] = low[s] = ++Time;
  for (int x : ed[s]) {
    if (!st[x]) {
      ch++;
      dfs(x, s);
      low[s] = min(low[s], low[x]);
      if (p != -1 && low[x] >= st[s])
        popBCC(s, x);
      else if (p == -1)
        if (ch > 1) popBCC(s, x);
    } else if (p != x)
      low[s] = min(low[s], st[x]);
  }
  if (p == -1 && ch > 1) cut[s] = 1;
}
void processBCC(int n) {
  for (int i = 1; i <= n; i++) bcc[i].clear();
  memset(st, 0, sizeof(st));
  memset(cut, 0, sizeof(cut));
  Time = tot = 0;
  for (int i = 1; i <= n; i++) {
    if (!st[i]) {
      dfs(i, -1);
      if (!S.empty()) ++tot;
      while (!S.empty()) {
        bcc[tot].push_back(S.top());
        S.pop();
      }
    }
  }
}
int nn;
vector<int> tree[MAX];
int compNum[MAX];
bool oc;
int dis[MAX];
void ogo(int s, int p, int id) {
  for (int x : BCT::ed[s]) {
    if (compNum[x] != id) continue;
    if (x == p or x == s) continue;
    if (dis[x]) {
      if (dis[x] % 2 == dis[s] % 2) oc = true;
    } else {
      dis[x] = dis[s] + 1;
      ogo(x, s, id);
    }
  }
}
void buildTree(int n) {
  processBCC(n);
  for (int i = 1; i <= tot; i++) {
    for (int v : bcc[i]) {
      compNum[v] = i;
      dis[v] = 0;
    }
    oc = false;
    dis[bcc[i][0]] = 1;
    ogo(bcc[i][0], bcc[i][0], i);
    ara[i] = oc;
    for (int q : bcc[i]) {
      for (int r : L[q]) {
        if (Q[r].done) continue;
        int a = Q[r].a;
        int b = Q[r].b;
        if (compNum[a] == compNum[b]) {
          Q[r].done = true;
          if (ara[i])
            Q[r].ans = true;
          else if ((dis[a] % 2) != (dis[b] % 2)) {
            Q[r].ans = true;
          } else
            Q[r].ans = false;
        }
      }
    }
    for (int v : bcc[i]) {
      compNum[v] = i;
      dis[v] = 0;
    }
  }
  nn = tot;
  for (int i = 1; i <= n; i++)
    if (cut[i]) compNum[i] = ++nn;
  for (int i = 1; i <= tot; i++) {
    for (int v : bcc[i]) {
      if (cut[v]) {
        tree[i].push_back(compNum[v]);
        tree[compNum[v]].push_back(i);
      } else {
        compNum[v] = i;
      }
    }
  }
}
};  // namespace BCT
namespace HLD {
int ptr, par[MAX];
int sz[MAX], h[MAX], pos[MAX], head[MAX], base[MAX];
struct SegmentTree {
  struct node {
    int mn;
  } tree[4 * MAX];
  node Merge(node a, node b) {
    node ret;
    ret.mn = a.mn + b.mn;
    return ret;
  }
  void build(int n, int st, int ed) {
    if (st == ed) {
      tree[n].mn = ara[base[st]];
      return;
    }
    int mid = (st + ed) / 2;
    build(2 * n, st, mid);
    build(2 * n + 1, mid + 1, ed);
    tree[n] = Merge(tree[2 * n], tree[2 * n + 1]);
  }
  node query(int n, int st, int ed, int i, int j) {
    if (st >= i && ed <= j) return tree[n];
    int mid = (st + ed) / 2;
    if (mid < i)
      return query(2 * n + 1, mid + 1, ed, i, j);
    else if (mid >= j)
      return query(2 * n, st, mid, i, j);
    else
      return Merge(query(2 * n, st, mid, i, j),
                   query(2 * n + 1, mid + 1, ed, i, j));
  }
} st;
void dfs(int u, int far) {
  sz[u] = 1, h[u] = far;
  for (int v : BCT::tree[u])
    BCT::tree[v].erase(find(BCT::tree[v].begin(), BCT::tree[v].end(), u));
  for (int &v : BCT::tree[u]) {
    par[v] = u;
    dfs(v, far + 1);
    sz[u] += sz[v];
    if (sz[v] > sz[BCT::tree[u][0]]) swap(v, BCT::tree[u][0]);
  }
}
void hld(int u) {
  pos[u] = ++ptr;
  base[ptr] = u;
  for (int v : BCT::tree[u]) {
    head[v] = (v == BCT::tree[u][0] ? head[u] : v);
    hld(v);
  }
}
inline int query(int n, int u, int v) {
  int res = 0;
  while (head[u] != head[v]) {
    if (h[head[u]] > h[head[v]]) swap(u, v);
    res += st.query(1, 1, n, pos[head[v]], pos[v]).mn;
    v = par[head[v]];
  }
  if (h[u] > h[v]) swap(u, v);
  res += st.query(1, 1, n, pos[u], pos[v]).mn;
  return res;
}
void build(int n, int root, int x) {
  ptr = 0;
  for (int i = 1; i <= n; i++) {
    if (!head[i]) {
      head[i] = i;
      h[i] = 0;
      dfs(i, 0);
      hld(i);
    }
  }
  st.build(1, 1, n);
}
};  // namespace HLD
int D[MAX];
int mark[MAX];
int cur = 0;
void call(int s, int d) {
  mark[s] = cur;
  D[s] = d;
  for (int x : BCT::ed[s]) {
    if (mark[x] == 0) call(x, d + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m, q, a, b;
  cin >> n >> m;
  int x = -1;
  for (int i = 1; i <= m; i++) {
    cin >> a >> b;
    if (x == -1) x = a;
    BCT::ed[a].push_back(b);
    BCT::ed[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (D[i] == 0) {
      cur++;
      call(i, 1);
    }
  }
  cin >> q;
  for (int i = 1; i <= q; i++) {
    cin >> Q[i].a >> Q[i].b;
    Q[i].done = Q[i].ans = 0;
    if (Q[i].b == Q[i].a) {
      Q[i].done = true;
      Q[i].ans = false;
      continue;
    }
    L[Q[i].a].push_back(i);
    L[Q[i].b].push_back(i);
    if (mark[Q[i].a] != mark[Q[i].b]) {
      Q[i].done = true;
      Q[i].ans = false;
    }
  }
  BCT::buildTree(n);
  HLD::build(BCT::nn, 1, n);
  for (int i = 1; i <= q; i++) {
    if (!Q[i].done) {
      if (D[Q[i].a] % 2 != D[Q[i].b] % 2) {
        Q[i].ans = 1;
      } else {
        int x = BCT::compNum[Q[i].a];
        int y = BCT::compNum[Q[i].b];
        Q[i].ans = HLD::query(BCT::nn, x, y);
      }
    }
    if (Q[i].ans)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  return 0;
}
