#include <bits/stdc++.h>
using namespace std;
int xx[4] = {0, 0, 1, -1};
int yy[4] = {1, -1, 0, 0};
int n, q;
char s[int(1e5 + 100)];
int f[int(1e5 + 100)][3];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = (1), _b = (n); i <= _b; i++) {
    for (int c = ('x'), _b = ('z'); c <= _b; c++)
      f[i][c - 'x'] = f[i - 1][c - 'x'];
    f[i][s[i] - 'x']++;
  }
  scanf("%d", &q);
  for (int i = (1), _b = (q); i <= _b; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (r - l + 1 < 3)
      printf("YES\n");
    else {
      int _min = min(f[r][2] - f[l - 1][2],
                     min(f[r][0] - f[l - 1][0], f[r][1] - f[l - 1][1]));
      int _max = max(f[r][2] - f[l - 1][2],
                     max(f[r][0] - f[l - 1][0], f[r][1] - f[l - 1][1]));
      if (_max - _min <= 1) {
        printf("YES\n");
      } else
        printf("NO\n");
    }
  }
}
