#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;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+IAogCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiAKY29uc3QgaW50IE4gPSAxMDAwMDEwOwpjb25zdCBsb25nIGxvbmcgTU9EID0gMWUxNCArIDc7CiAKaW50IG4sIG0sIHE7CmxvbmcgbG9uZyBlZGdlW05dOwpsb25nIGxvbmcgaGFzaFZhbHVlW05dOwogCmludCBtYWluIChpbnQgYXJnYywgY2hhciBjb25zdCAqYXJndltdKSB7CiAgc2NhbmYoIiVkICVkIiwgJm4sICZtKTsKICBmb3IgKGludCBpID0gMTsgaSA8PSBuOyArK2kpIHsKICAJaGFzaFZhbHVlW2ldID0gKHJhbmQoKSAqIDFMTCAqIHJhbmQoKSkgJSBNT0Q7CiAgfQogIGZvciAoaW50IGkgPSAxOyBpIDw9IG07ICsraSkgewogICAgaW50IHUsIHY7CiAgICBzY2FuZigiJWQgJWQiLCAmdSwgJnYpOwogICAgZWRnZVtpXSA9IGhhc2hWYWx1ZVt1XSBeIGhhc2hWYWx1ZVt2XTsKICB9CiAgZm9yIChpbnQgaSA9IDE7IGkgPD0gbTsgKytpKSB7CiAgCWVkZ2VbaV0gXj0gZWRnZVtpIC0gMV07CiAgfQogIHNjYW5mKCIlZCIsICZxKTsgCiAgZm9yIChpbnQgaSA9IDE7IGkgPD0gcTsgKytpKSB7CiAgICBpbnQgbCwgcjsKICAgIHNjYW5mKCIlZCAlZCIsICZsLCAmcik7CiAgICBwdXRzKGVkZ2Vbcl0gXiBlZGdlW2wgLSAxXSA/ICJObyIgOiAiWWVzIik7CiAgfQogIHJldHVybiAwOwp9Cgo=