#include <bits/stdc++.h>
using namespace std;
char s[100001];
int count1[100001];
int count2[100001];
int count3[100001];
int main() {
  scanf("%s", s);
  int l1 = strlen(s);
  for (int i = 0; i < l1; i++) {
    count1[i + 1] = count1[i];
    count2[i + 1] = count2[i];
    count3[i + 1] = count3[i];
    if (s[i] == 'x') {
      count1[i + 1]++;
    }
    if (s[i] == 'y') {
      count2[i + 1]++;
    }
    if (s[i] == 'z') {
      count3[i + 1]++;
    }
  }
  int q;
  scanf("%d", &q);
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    int l1 = (r - l + 1) / 3;
    int mod1 = (r - l + 1) % 3;
    int temp1 = count1[r] - count1[l - 1];
    int temp2 = count2[r] - count2[l - 1];
    int temp3 = count3[r] - count3[l - 1];
    bool poss = false;
    if ((r - l + 1) < 3) {
      poss = true;
    }
    if (mod1 == 0) {
      if (temp1 == temp2 && temp2 == temp3 && temp1 == l1) {
        poss = true;
      }
    } else if (mod1 == 1) {
      if (temp1 == l1 + 1 && temp2 == l1 && temp3 == l1) {
        poss = true;
      } else if (temp2 == l1 + 1 && temp1 == l1 && temp3 == l1) {
        poss = true;
      } else if (temp3 == l1 + 1 && temp2 == l1 && temp1 == l1) {
        poss = true;
      }
    } else if (mod1 == 2) {
      if (temp1 == l1 && temp2 == l1 + 1 && temp3 == l1 + 1) {
        poss = true;
      } else if (temp2 == l1 && temp1 == l1 + 1 && temp3 == l1 + 1) {
        poss = true;
      } else if (temp3 == l1 && temp2 == l1 + 1 && temp1 == l1 + 1) {
        poss = true;
      }
    }
    if (poss) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
  return 0;
}
