#include <bits/stdc++.h>
using namespace std;
char dic[4][100] = {"zyx", "xzy", "yxz"};
char s[1000000];
int abc[4][200000];
int main() {
  scanf("%s", &s);
  int i, j, k;
  int a, b, n;
  for (i = 0; s[i] != '\0'; i++) {
    abc[1][i + 1] = abc[1][i];
    abc[2][i + 1] = abc[2][i];
    abc[3][i + 1] = abc[3][i];
    if (s[i] == 'x') abc[1][i + 1]++;
    if (s[i] == 'y') abc[2][i + 1]++;
    if (s[i] == 'z') abc[3][i + 1]++;
  }
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &a, &b);
    if (b - a < 2) {
      printf("YES\n");
      continue;
    }
    int x, y, z;
    x = abc[1][b] - abc[1][a - 1];
    y = abc[2][b] - abc[2][a - 1];
    z = abc[3][b] - abc[3][a - 1];
    if (abs(x - y) <= 1 && abs(z - x) <= 1 && abs(y - z) <= 1)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
