#include using namespace std; using ll = long long; //mint61 a;のように宣言する template struct modint61 { using mint = modint61; long long v; modint61() : v(0) {} template modint61(T x) { while(x < 0) x += MOD; while(x >= MOD) x -= MOD; v = x; } long long safe_mod(long long x){ x = (x >> 61) + (x & MOD); if (x >= MOD) x -= MOD; return x; } static constexpr long long mod() { return MOD; } mint& operator++() {v++; if(v == MOD)v = 0; return *this;} mint& operator--() {if(v == 0)v = MOD; v--; return *this;} mint operator++(int) { mint result = *this; ++*this; return result; } mint operator--(int) { mint result = *this; --*this; return result; } mint& operator+=(const mint& rhs) { v += rhs.v; if(v >= MOD) v -= MOD; return *this; } mint& operator-=(const mint& rhs) { if(v < rhs.v) v += MOD; v -= rhs.v; return *this; } mint& operator*=(const mint& rhs) { long long u = v >> 31, d = v & MASK31; long long ru = rhs.v >> 31, rd = rhs.v & MASK31; long long mid = d * ru + u * rd; v = safe_mod(u * ru * 2 + (mid >> 30) + ((mid & MASK30) << 31) + d * rd); return *this; } mint& operator/=(const mint& rhs) { return *this = *this * rhs.inv(); } mint operator+() const { return *this; } mint operator-() const { return mint() - *this; } mint pow(long long n) const { assert(0 <= n); mint r = 1, x = *this; while (n) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; } mint inv() const { assert(v); return pow(MOD - 2); } friend mint operator+(const mint& lhs, const mint& rhs) { return mint(lhs) += rhs; } friend mint operator-(const mint& lhs, const mint& rhs) { return mint(lhs) -= rhs; } friend mint operator*(const mint& lhs, const mint& rhs) { return mint(lhs) *= rhs; } friend mint operator/(const mint& lhs, const mint& rhs) { return mint(lhs) /= rhs; } friend bool operator<(const mint& lhs, const mint& rhs) { return lhs.v < rhs.v; } friend bool operator==(const mint& lhs, const mint& rhs) { return (lhs.v == rhs.v); } friend bool operator!=(const mint& lhs, const mint& rhs) { return (lhs.v != rhs.v); } friend std::istream& operator >> (std::istream& is, mint& rhs) noexcept { long long tmp; rhs = mint{(is >> tmp, tmp)}; return is; } friend std::ostream& operator << (std::ostream &os, const mint& rhs) noexcept { return os << rhs.v; } }; using mint61 = modint61<2305843009213693951>; template struct prime_modint { using mint = prime_modint; unsigned int v; prime_modint() : v(0) {} prime_modint(unsigned int a) { a %= MOD; v = a; } prime_modint(unsigned long long a) { a %= MOD; v = a; } prime_modint(int a) { a %= (int)(MOD); if(a < 0)a += MOD; v = a; } prime_modint(long long a) { a %= (int)(MOD); if(a < 0)a += MOD; v = a; } static constexpr int mod() { return MOD; } mint& operator++() {v++; if(v == MOD)v = 0; return *this;} mint& operator--() {if(v == 0)v = MOD; v--; return *this;} mint operator++(int) { mint result = *this; ++*this; return result; } mint operator--(int) { mint result = *this; --*this; return result; } mint& operator+=(const mint& rhs) { v += rhs.v; if(v >= MOD) v -= MOD; return *this; } mint& operator-=(const mint& rhs) { if(v < rhs.v) v += MOD; v -= rhs.v; return *this; } mint& operator*=(const mint& rhs) { v = (unsigned int)((unsigned long long)(v) * rhs.v % MOD); return *this; } mint& operator/=(const mint& rhs) { return *this = *this * rhs.inv(); } mint operator+() const { return *this; } mint operator-() const { return mint() - *this; } mint pow(long long n) const { assert(0 <= n); mint r = 1, x = *this; while (n) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; } mint inv() const { assert(v); return pow(MOD - 2); } friend mint operator+(const mint& lhs, const mint& rhs) { return mint(lhs) += rhs; } friend mint operator-(const mint& lhs, const mint& rhs) { return mint(lhs) -= rhs; } friend mint operator*(const mint& lhs, const mint& rhs) { return mint(lhs) *= rhs; } friend mint operator/(const mint& lhs, const mint& rhs) { return mint(lhs) /= rhs; } friend bool operator==(const mint& lhs, const mint& rhs) { return (lhs.v == rhs.v); } friend bool operator!=(const mint& lhs, const mint& rhs) { return (lhs.v != rhs.v); } friend std::ostream& operator << (std::ostream &os, const mint& rhs) noexcept { return os << rhs.v; } }; using mint1 = prime_modint<1000000007>; using mint2 = prime_modint<998244353>; int main(){ ios::sync_with_stdio(false); cin.tie(0); ll n, q, k, l, r; cin >> n >> q >> k; vector> s(n + 1); tuple BASE = {k, k, k}, d = {1, 1, 1}; vector a(n); for(int i = 0; i < n; i++){ cin >> a[i]; get<0>(s[i + 1]) = get<0>(s[i]) + a[i] * get<0>(d); get<1>(s[i + 1]) = get<1>(s[i]) + a[i] * get<1>(d); get<2>(s[i + 1]) = get<2>(s[i]) + a[i] * get<2>(d); get<0>(d) *= get<0>(BASE); get<1>(d) *= get<1>(BASE); get<2>(d) *= get<2>(BASE); } while(q--){ cin >> l >> r; cout << (((r - l - 1 & 1) && a[r - 1] != 0) || s[r] != s[l - 1] ? "Yes" : "No") << '\n'; } }