#include <bits/stdc++.h>
char str[100010];
int count[3][100010];
int main(void) {
  scanf("%s", str + 1);
  for (int i = 1; str[i] != 0; i++) {
    for (int j = 0; j < 3; j++) {
      count[j][i] = count[j][i - 1];
    }
    count[str[i] - 'x'][i]++;
  }
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int s, e, tot;
    scanf("%d%d", &s, &e);
    if (e - s + 1 <= 2) {
      printf("YES\n");
      continue;
    }
    tot = e - s + 1;
    int arr[] = {count[0][e] - count[0][s - 1], count[1][e] - count[1][s - 1],
                 count[2][e] - count[2][s - 1]};
    std::sort(arr, arr + 3);
    if (tot % 3 == 0) {
      if (arr[0] == arr[1] && arr[1] == arr[2])
        printf("YES\n");
      else
        printf("NO\n");
    } else if (tot % 3 == 1) {
      if (arr[0] == arr[1] && arr[1] + 1 == arr[2])
        printf("YES\n");
      else
        printf("NO\n");
    } else {
      if (arr[2] == arr[1] && arr[1] - 1 == arr[0])
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
}
