#include <bits/stdc++.h>
using namespace std;
char q[100005];
int m;
int numx[100005], numy[100005], numz[100005];
int main() {
  int i, k, begin, end;
  scanf("%s", q + 1);
  int n = strlen(q + 1);
  numx[0] = 0;
  numy[0] = 0;
  numz[0] = 0;
  for (i = 1; i <= n; i++) {
    if (q[i] == 'x') {
      numx[i] = numx[i - 1] + 1;
      numy[i] = numy[i - 1];
      numz[i] = numz[i - 1];
    }
    if (q[i] == 'y') {
      numy[i] = numy[i - 1] + 1;
      numx[i] = numx[i - 1];
      numz[i] = numz[i - 1];
    }
    if (q[i] == 'z') {
      numz[i] = numz[i - 1] + 1;
      numy[i] = numy[i - 1];
      numx[i] = numx[i - 1];
    }
  }
  scanf("%d", &m);
  for (k = 1; k <= m; k++) {
    scanf("%d%d", &begin, &end);
    if (end - begin < 2)
      printf("YES\n");
    else {
      int n1 = numx[end] - numx[begin - 1], n2 = numy[end] - numy[begin - 1],
          n3 = numz[end] - numz[begin - 1];
      int Max = max(n1, max(n2, n3));
      int Min = min(n1, min(n2, n3));
      if (Max - Min <= 1) {
        if ((n3 >= n1) || (n2 >= n3) || (n1 >= n2))
          printf("YES\n");
        else
          printf("NO\n");
      } else
        printf("NO\n");
    }
  }
  return 0;
}
