#include <bits/stdc++.h>
unsigned int const L = 1e5 + 42;
char S[L];
unsigned int cx[L] = {};
unsigned int cy[L] = {};
unsigned int cz[L] = {};
int main() {
  scanf("%s", S);
  unsigned int N = strlen(S);
  for (unsigned int i = 0; i < N; ++i) {
    cx[i + 1] = cx[i] + (S[i] == 'x');
    cy[i + 1] = cy[i] + (S[i] == 'y');
    cz[i + 1] = cz[i] + (S[i] == 'z');
  }
  unsigned int M = 0;
  scanf("%u", &M);
  for (unsigned int i = 0; i < M; ++i) {
    unsigned int l, r;
    scanf("%u%u", &l, &r);
    unsigned int n = r - l + 1;
    unsigned int n0 = n / 3;
    unsigned int nx = cx[r] - cx[l - 1];
    unsigned int ny = cy[r] - cy[l - 1];
    unsigned int nz = cz[r] - cz[l - 1];
    if (n < 3 || n0 <= nx && nx <= n0 + 1 && n0 <= ny && ny <= n0 + 1 &&
                     n0 <= nz && nz <= n0 + 1)
      printf("YES\n");
    else
      printf("NO\n");
  }
}
