#include <bits/stdc++.h>
using namespace std;
char s[100000 + 10];
int x[100000 + 10], y[100000 + 10], z[100000 + 10];
int main() {
  while (scanf("%s", &s) != EOF) {
    memset(x, 0, sizeof(x));
    memset(y, 0, sizeof(y));
    memset(z, 0, sizeof(z));
    int xx, yy, zz, n;
    zz = yy = xx = 0;
    scanf("%d", &n);
    for (int i = 0; i < strlen(s); i++) {
      if (s[i] == 'x') xx++;
      if (s[i] == 'y') yy++;
      if (s[i] == 'z') zz++;
      x[i] = xx;
      z[i] = zz;
      y[i] = yy;
    }
    int l, r;
    while (n--) {
      scanf("%d%d", &l, &r);
      int a = x[r - 1] - x[l - 2];
      int b = y[r - 1] - y[l - 2];
      int c = z[r - 1] - z[l - 2];
      if (r - l < 2)
        printf("YES\n");
      else {
        if (abs(a - c) <= 1 && abs(a - b) <= 1 && abs(b - c) <= 1)
          printf("YES\n");
        else
          printf("NO\n");
      }
    }
    memset(s, 0, sizeof(s));
  }
  return 0;
}
