#include <bits/stdc++.h>
using namespace std;
int cnt[3][100001];
int solve(int l, int r) {
  int i, c[3], len, v;
  len = r - l + 1;
  if (len < 3) return 1;
  for (i = 0; i < 3; i++) c[i] = cnt[i][r] - cnt[i][l - 1];
  v = len / 3;
  for (i = 0; i < 3; i++) {
    if (c[i] < v)
      return 0;
    else {
      if ((c[i] - v) == 2) return 0;
    }
  }
  return 1;
}
int main(void) {
  int i, m, l, r;
  char s[100001];
  char *ss = s;
  scanf("%s", s);
  scanf("%d", &m);
  i = 1;
  cnt[0][0] = cnt[1][0] = cnt[2][0] = 0;
  while (*ss) {
    cnt[0][i] = cnt[0][i - 1];
    cnt[1][i] = cnt[1][i - 1];
    cnt[2][i] = cnt[2][i - 1];
    cnt[(*ss) - 'x'][i]++;
    i++;
    ss++;
  }
  while (m--) {
    scanf("%d %d", &l, &r);
    printf("%s\n", solve(l, r) ? "YES" : "NO");
  }
  return 0;
}
