#include <bits/stdc++.h>
using namespace std;
const int MAX = (int)1e5 + 5;
char str[MAX];
int a[MAX][3] = {0};
int main() {
  int M, L, R;
  scanf("%s", str);
  scanf("%d", &M);
  for (int i = 1; i <= (int)strlen(str); i++) {
    a[i][0] = a[i - 1][0];
    a[i][1] = a[i - 1][1];
    a[i][2] = a[i - 1][2];
    a[i][str[i - 1] - 'x']++;
  }
  for (int i = 1; i <= M; i++) {
    scanf("%d %d", &L, &R);
    int x = (a[R][0] - a[L - 1][0]);
    int y = (a[R][1] - a[L - 1][1]);
    int z = (a[R][2] - a[L - 1][2]);
    if ((R - L + 1) >= 3 &&
        (abs(x - y) > 1 || abs(y - z) > 1 || abs(z - x) > 1))
      printf("NO\n");
    else
      printf("YES\n");
  }
  return 0;
}
