#include <bits/stdc++.h>
using namespace std;
const int MAXN = 101000;
int n;
char ch[MAXN];
int cntX[MAXN];
int cntY[MAXN];
int cntZ[MAXN];
inline int ABS(int x) { return x > 0 ? x : -x; }
int main() {
  while (scanf("%s", ch) != EOF) {
    int len = strlen(ch);
    memset(cntX, 0, sizeof(cntX));
    memset(cntY, 0, sizeof(cntY));
    memset(cntZ, 0, sizeof(cntZ));
    int x = 0, y = 0, z = 0;
    for (int i = 0; i < len; i++) {
      if (ch[i] == 'x')
        x++;
      else if (ch[i] == 'y')
        y++;
      else if (ch[i] == 'z')
        z++;
      cntX[i + 1] = x;
      cntY[i + 1] = y;
      cntZ[i + 1] = z;
    }
    int l, r;
    scanf("%d", &n);
    while (n--) {
      scanf("%d%d", &l, &r);
      len = r - l + 1;
      if (len < 3) {
        printf("YES\n");
        continue;
      }
      x = cntX[r] - cntX[l - 1];
      y = cntY[r] - cntY[l - 1];
      z = cntZ[r] - cntZ[l - 1];
      if (ABS(x - y) <= 1 && ABS(x - z) <= 1 && ABS(y - z) <= 1)
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
  return 0;
}
