#include <bits/stdc++.h>
int x[100050] = {
    0,
};
int y[100050] = {
    0,
};
int z[100050] = {
    0,
};
int main() {
  char buf[100050];
  scanf("%s", buf);
  int len = strlen(buf);
  for (int i = 1; i <= len; i++) {
    x[i] = x[i - 1];
    y[i] = y[i - 1];
    z[i] = z[i - 1];
    if (buf[i - 1] == 'x')
      x[i]++;
    else if (buf[i - 1] == 'y')
      y[i]++;
    else if (buf[i - 1] == 'z')
      z[i]++;
  }
  int m;
  scanf("%d", &m);
  while (m--) {
    int l, r;
    int ans = 0;
    scanf("%d%d", &l, &r);
    int s[5];
    s[0] = x[r] - x[l - 1];
    s[1] = y[r] - y[l - 1];
    s[2] = z[r] - z[l - 1];
    std::sort(s, s + 3);
    if (s[2] < s[0] + 2 || r - l < 2) ans = 1;
    if (ans)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
