#include <bits/stdc++.h>
char str[100010];
int count[100010][4] = {0};
int main(void) {
  int n, m;
  int i;
  scanf("%s", str);
  n = strlen(str);
  for (i = 0; i < n; i++) {
    int op;
    for (op = 0; op < 4; op++) count[i + 1][op] = count[i][op];
    switch (str[i]) {
      case 'x':
      case 'y':
      case 'z':
        op = str[i] - 'x';
        break;
      default:
        op = 3;
        break;
    }
    count[i + 1][op]++;
  }
  scanf("%d", &m);
  while (m--) {
    int f, t;
    int arr[4];
    scanf("%d%d", &f, &t);
    for (i = 0; i < 4; i++) {
      arr[i] = count[t][i] - count[f - 1][i];
    }
    if (arr[3]) {
      printf("NO");
      goto no;
    } else {
      int avg = arr[0] + arr[1] + arr[2];
      if (avg < 3) goto yes;
      avg /= 3;
      for (i = 0; i < 3; i++)
        if (avg != arr[i] && avg != arr[i] - 1) {
          printf("NO");
          goto no;
        }
    }
  yes:
    printf("YES");
  no:
    printf("\n");
  }
  return 0;
}
