#include <bits/stdc++.h>
using namespace std;
char s[200 * 1000];
int z[1000 * 200], y[1000 * 200], x[1000 * 200];
int fls[200 * 1000];
int main() {
  cin >> s;
  int n;
  for (int i = 1; s[i - 1]; ++i) {
    z[i] = z[i - 1] + (s[i - 1] == 'z');
    x[i] = x[i - 1] + (s[i - 1] == 'x');
    y[i] = y[i - 1] + (s[i - 1] == 'y');
    if (i >= 3) {
      int bl[3] = {};
      for (int j = i - 3; j < i; ++j) bl[s[j] - 'x'] = 1;
      fls[i] = !(bl[0] && bl[1] && bl[2]);
    }
    fls[i] += fls[i - 1];
    n = i;
  }
  int m;
  cin >> m;
  int L, R;
  int ss[3];
  for (int i = (0), e_i = (m); i < e_i; ++i) {
    cin >> L >> R;
    ss[0] = z[R] - z[L - 1], ss[1] = y[R] - y[L - 1], ss[2] = x[R] - x[L - 1];
    sort(ss, ss + 3);
    bool ok = ss[2] == ss[0] || (ss[2] == ss[1] && ss[1] == ss[0] + 1) ||
              (ss[2] == ss[0] + 1 && ss[1] == ss[0]);
    if (R - L > 1 && !ok)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
