#include <bits/stdc++.h> 
 
using namespace std;
 
const int N = 1000010;
const long long MOD = 1e14 + 7;
 
int n, m, q;
long long edge[N];
long long hashValue[N];
 
int main (int argc, char const *argv[]) {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; ++i) {
  	hashValue[i] = (rand() * 1LL * rand()) % MOD;
  }
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    edge[i] = hashValue[u] ^ hashValue[v];
  }
  for (int i = 1; i <= m; ++i) {
  	edge[i] ^= edge[i - 1];
  }
  scanf("%d", &q); 
  for (int i = 1; i <= q; ++i) {
    int l, r;
    scanf("%d %d", &l, &r);
    puts(edge[r] ^ edge[l - 1] ? "No" : "Yes");
  }
  return 0;
}

