#include <bits/stdc++.h>
const double pi = acos(-1.0);
using namespace std;
int x[212345], y[212345], z[212345], lon;
bool ok(int a, int b, int c) {
  int na, nb, nc;
  if (lon == 2 && a == 2) return true;
  na = lon / 3;
  nb = lon / 3;
  nc = lon / 3;
  if (lon % 3 > 0) ++na;
  if (lon % 3 > 1) ++nb;
  if ((a == na) && (b == nb) && (c == nc)) return true;
  return false;
}
int main() {
  string s;
  getline(cin, s);
  for (int i = 0; i < s.length(); ++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;
    x[i + 1] += x[i];
    y[i + 1] += y[i];
    z[i + 1] += z[i];
  }
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int l, r, X, Y, Z;
    scanf("%d%d", &l, &r);
    X = x[r] - x[l - 1];
    Y = y[r] - y[l - 1];
    Z = z[r] - z[l - 1];
    lon = r - l + 1;
    if (ok(X, Z, Y) || ok(Y, X, Z) || ok(Z, Y, X))
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
