#include <bits/stdc++.h>
using namespace std;
int X[100000 + 5], Y[100000 + 5], Z[100000 + 5];
int x, y, z, i, N, M, l, r, k;
char sir[100000 + 5], *p;
void files();
inline int md(int x) {
  if (x < 0) return (-x);
  return x;
}
int main() {
  scanf("%s", sir + 1);
  for (i = 1, p = sir + 1; *p; p++, i++) {
    X[i] = X[i - 1];
    Y[i] = Y[i - 1];
    Z[i] = Z[i - 1];
    if (*p == 'x') X[i]++;
    if (*p == 'y') Y[i]++;
    if (*p == 'z') Z[i]++;
  }
  scanf("%d", &M);
  for (; M; --M) {
    scanf("%d%d", &l, &r);
    x = X[r] - X[l - 1];
    y = Y[r] - Y[l - 1];
    z = Z[r] - Z[l - 1];
    k = md(x - y);
    k = max(k, md(x - z));
    k = max(k, md(y - z));
    if (k > 1 && r - l + 1 >= 3)
      printf("NO\n");
    else
      printf("YES\n");
  }
  return 0;
}
void files() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
