#include <bits/stdc++.h>
using namespace std;
int x[110000], y[110000], z[110000];
char s[110000];
int n, m, p, q;
int main() {
  scanf("%s", &s);
  int len = strlen(s);
  getchar();
  memset(x, 0, sizeof x);
  memset(y, 0, sizeof y);
  memset(z, 0, sizeof z);
  for (int i = 0; i < len; i++) {
    if (s[i] == 'x') x[i + 1] = 1;
    if (s[i] == 'y') y[i + 1] = 1;
    if (s[i] == 'z') z[i + 1] = 1;
  }
  for (int i = 1; i <= len; i++) {
    x[i] += x[i - 1];
    y[i] += y[i - 1];
    z[i] += z[i - 1];
  }
  int xx, yy, zz;
  int l, r;
  scanf("%d", &m);
  int maxx, minn;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &l, &r);
    if (r - l + 1 <= 2) {
      puts("YES");
      continue;
    }
    xx = x[r] - x[l - 1];
    yy = y[r] - y[l - 1];
    zz = z[r] - z[l - 1];
    maxx = max(xx, max(yy, zz));
    minn = min(xx, min(yy, zz));
    if (maxx - minn >= 2)
      puts("NO");
    else
      puts("YES");
  }
  return 0;
}
