#include <bits/stdc++.h>
using namespace std;
long long ans, a, b, c[1234567], c1[123455][4], d[1234567], e, i, j, n, k, x, y,
    ideh[1234567], l, r;
map<pair<long long, long long>, long long> m;
vector<pair<long long, long long>> v1[1234567], v, vma, vmi;
vector<long long>::iterator it;
string s, s1[1234567];
multiset<long long> ms;
set<char> se;
queue<long long> q;
deque<long long> dq;
pair<long long, long long> p[123456];
priority_queue<long long> pq;
int main() {
  ios_base::sync_with_stdio();
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  cin >> n;
  c1[0][1] = 0;
  c1[0][2] = 0;
  c1[0][3] = 0;
  for (int i = 0; i <= s.size(); i++) {
    j = i + 1;
    c1[j][1] = c1[j - 1][1];
    c1[j][2] = c1[j - 1][2];
    c1[j][3] = c1[j - 1][3];
    if (s[i] == 'x') c1[j][1]++;
    if (s[i] == 'y') c1[j][2]++;
    if (s[i] == 'z') c1[j][3]++;
  }
  while (n--) {
    cin >> l >> r;
    long long x, y, z;
    x = c1[r][1] - c1[l - 1][1];
    y = c1[r][2] - c1[l - 1][2];
    z = c1[r][3] - c1[l - 1][3];
    k = 1;
    if (x - y > 1 || x - z > 1 || y - z > 1) k = 0;
    if (y - x > 1 || z - x > 1 || z - y > 1) k = 0;
    if (x + y + z <= 2) k = 1;
    if (k == 1) {
      cout << "YES"
           << "\n";
    } else
      cout << "NO"
           << "\n";
  }
}
