#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[100004];
  int i, n, l, r, xnum, ynum, znum;
  scanf("%s", s);
  n = strlen(s);
  int x[100004] = {0};
  int y[100004] = {0};
  int z[100004] = {0};
  if (s[0] == 'x')
    x[0]++;
  else if (s[0] == 'y')
    y[0]++;
  else
    z[0]++;
  for (i = 1; i < n; i++) {
    if (s[i] == 'x') {
      x[i] = x[i - 1] + 1;
      y[i] = y[i - 1];
      z[i] = z[i - 1];
    } else if (s[i] == 'y') {
      y[i] = y[i - 1] + 1;
      x[i] = x[i - 1];
      z[i] = z[i - 1];
    } else {
      z[i] = z[i - 1] + 1;
      x[i] = x[i - 1];
      y[i] = y[i - 1];
    }
  }
  scanf("%d", &n);
  for (int i = (int)0; i < (int)n; i++) {
    scanf("%d", &l);
    scanf("%d", &r);
    if (r - l < 2) {
      printf("%s\n", "YES");
      continue;
    }
    l--;
    r--;
    xnum = x[r];
    if (l > 0) xnum -= x[l - 1];
    ynum = y[r];
    if (l > 0) ynum -= y[l - 1];
    znum = z[r];
    if (l > 0) znum -= z[l - 1];
    if ((abs(xnum - ynum) > 1) || (abs(ynum - znum) > 1) ||
        (abs(znum - xnum) > 1))
      printf("%s\n", "NO");
    else
      printf("%s\n", "YES");
  }
  return 0;
}
