#include <bits/stdc++.h>
using namespace std;
int main() {
  char A[100005];
  int x[100005], y[100005], z[100005], l, r, n, p, q, t, r1;
  cin >> A;
  n = strlen(A);
  for (int i = 1; i <= n; i++) {
    if (A[i - 1] == 'x') {
      x[i] = x[i - 1] + 1;
      y[i] = y[i - 1];
      z[i] = z[i - 1];
    }
    if (A[i - 1] == 'y') {
      y[i] = y[i - 1] + 1;
      x[i] = x[i - 1];
      z[i] = z[i - 1];
    }
    if (A[i - 1] == 'z') {
      z[i] = z[i - 1] + 1;
      y[i] = y[i - 1];
      x[i] = x[i - 1];
    }
  }
  cin >> t;
  while (t--) {
    cin >> l >> r1;
    if (r1 - l + 1 <= 2) {
      cout << "YES\n";
      continue;
    }
    p = x[r1] - x[l - 1];
    q = y[r1] - y[l - 1];
    r = z[r1] - z[l - 1];
    int f = 0;
    if ((p == q) && (q == r)) f = 1;
    if (((p == q) && (abs(q - r) == 1)) || ((p == r) && (abs(q - r) == 1)) ||
        ((r == q) && (abs(p - r) == 1)))
      f = 1;
    if (f == 1)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
