#include <bits/stdc++.h>
const int N = 100005;
char slowo[N];
int ile[3][N];
bool mozna(int a, int b) {
  if (b - a + 1 < 3) return 1;
  int suma = 0;
  for (int j = 0; j < 3; j++) suma += ile[j][b] - ile[j][a - 1];
  suma /= 3;
  for (int j = 0; j < 3; j++)
    if (ile[j][b] - ile[j][a - 1] < suma ||
        ile[j][b] - ile[j][a - 1] > suma + 1)
      return 0;
  return 1;
}
int main() {
  int m, a, b;
  scanf("%s", slowo + 1);
  for (int i = 1; slowo[i]; i++) {
    for (int j = 0; j < 3; j++) ile[j][i] = ile[j][i - 1];
    ile[slowo[i] - 'x'][i]++;
  }
  int suma;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &a, &b);
    printf("%s\n", mozna(a, b) ? "YES" : "NO");
  }
  return 0;
}
