#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 6;
char s[N];
int d[N], x[N], y[N], z[N];
int main() {
  int n, m;
  cin >> s >> m;
  n = strlen(s);
  d[0] = 0;
  d[1] = 0;
  for (int i = 2; i < n; ++i) {
    d[i] = 1;
    if (s[i] == 'z' && s[i - 1] == 'x' && s[i - 2] == 'y') continue;
    if (s[i] == 'y' && s[i - 1] == 'z' && s[i - 2] == 'x') continue;
    if (s[i] == 'x' && s[i - 1] == 'y' && s[i - 2] == 'z') continue;
    d[i] = 0;
  }
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'x') ++x[i];
    if (s[i] == 'y') ++y[i];
    if (s[i] == 'z') ++z[i];
  }
  for (int i = n - 1; i >= 0; --i) d[i] += d[i + 1];
  for (int i = n - 1; i >= 0; --i) x[i] += x[i + 1];
  for (int i = n - 1; i >= 0; --i) y[i] += y[i + 1];
  for (int i = n - 1; i >= 0; --i) z[i] += z[i + 1];
  while (m--) {
    int i, j;
    cin >> i >> j;
    --i;
    --j;
    int l = j - i + 1;
    int k = d[i + 2] - d[j + 1];
    if (l < 3 || k == l - 2)
      puts("YES");
    else {
      int c = l / 3;
      int r = l % 3;
      int cx = x[i] - x[j + 1];
      int cy = y[i] - y[j + 1];
      int cz = z[i] - z[j + 1];
      vector<int> v;
      v.push_back(cx);
      v.push_back(cy);
      v.push_back(cz);
      sort(v.rbegin(), v.rend());
      bool ok = 1;
      for (int i = 0; i < r; ++i) ok &= v[i] == c + 1;
      for (int i = r; i < 3; ++i) ok &= v[r] == c;
      if (ok)
        puts("YES");
      else
        puts("NO");
    }
  }
  return 0;
}
