#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e5 + 20, mxk = 20;
stack<int> stk;
vector<int> cp[maxx], g[maxx];
vector<pair<int, int> > adj[maxx];
int zoj[maxx], in[maxx], pid[maxx], n, m, q, x,
    co = 0, y, par[maxx][mxk], mh[maxx], dp[maxx][mxk], h[maxx];
bool vis[maxx], vism[maxx], mark[maxx];
pair<int, int> e[maxx];
bool fard;
void dfs2(int root, int c = 1) {
  vis[root] = true;
  zoj[root] = c;
  for (int x : g[root]) {
    if (!vis[x])
      dfs2(x, 3 - c);
    else if (zoj[x] != 3 - c)
      fard = true;
  }
}
void dfs(int root, int hh = 0, int pr = -1) {
  h[root] = mh[root] = hh;
  if (pr == -1) pr = root;
  par[root][0] = pr;
  vis[root] = true;
  for (pair<int, int> e : adj[root]) {
    int x = e.first, id = e.second;
    if (!vis[x]) {
      in[x] = id;
      if (!vism[id]) stk.push(id), vism[id] = true;
      pid[x] = id;
      dfs(x, hh + 1, root), mh[root] = min(mh[root], mh[x]);
    } else {
      mh[root] = min(mh[root], h[x]);
      if (!vism[id]) stk.push(id), vism[id] = true;
    }
  }
  if (h[root] && mh[root] >= h[root] - 1) {
    while (stk.top() != in[root]) cp[co].push_back(stk.top()), stk.pop();
    cp[co++].push_back(stk.top()), stk.pop();
  }
}
bool lca(int x, int y) {
  if (par[x][19] != par[y][19]) return false;
  int tool = 0;
  bool ans = false;
  if (h[x] > h[y]) swap(x, y);
  int g = h[y] - h[x];
  tool += g;
  if (g % 2) return true;
  for (int i = 0; i < mxk; i++)
    if (g & (1 << i)) ans = (ans || dp[y][i]), y = par[y][i];
  if (x == y) return (ans);
  for (int i = mxk - 1; i >= 0; i--) {
    if (par[x][i] != par[y][i])
      ans = (ans || dp[x][i]), ans = (ans || dp[y][i]), x = par[x][i],
      y = par[y][i];
  }
  ans = (ans || dp[x][0]);
  ans = (ans || dp[y][0]);
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    x--, y--;
    e[i] = {x, y};
    adj[x].push_back({y, i});
    adj[y].push_back({x, i});
  }
  for (int i = 0; i < n; i++)
    if (!vis[i]) dfs(i);
  for (int i = 1; i < mxk; i++) {
    for (int j = 0; j < n; j++) par[j][i] = par[par[j][i - 1]][i - 1];
  }
  memset(vis, false, sizeof vis);
  for (int i = 0; i < co; i++) {
    for (int x : cp[i])
      g[e[x].first].push_back(e[x].second),
          g[e[x].second].push_back(e[x].first);
    fard = false;
    dfs2(e[cp[i][0]].first);
    if (fard)
      for (int x : cp[i]) mark[x] = true;
    for (int x : cp[i])
      g[e[x].first].clear(), g[e[x].second].clear(),
          zoj[e[x].first] = 0, zoj[e[x].second] = 0, vis[e[x].first] = false,
          vis[e[x].second] = false;
  }
  for (int i = 0; i < n; i++) {
    if (par[i][0] == i)
      dp[i][0] = false;
    else
      dp[i][0] = mark[pid[i]];
  }
  for (int i = 1; i < mxk; i++) {
    for (int j = 0; j < n; j++)
      dp[j][i] = (dp[j][i - 1] || dp[par[j][i - 1]][i - 1]);
  }
  cin >> q;
  while (q--) {
    cin >> x >> y;
    x--, y--;
    if (lca(x, y))
      cout << "Yes" << '\n';
    else
      cout << "No" << '\n';
  }
  return 0;
}
