#include <bits/stdc++.h>
using namespace std;
int x[100009] = {0}, y[100009] = {0}, z[100009] = {0};
string s;
bool good(int l, int r) {
  int a = x[r] - x[l];
  int b = y[r] - y[l];
  int c = z[r] - z[l];
  if ((a == 2 && b == 0 && c == 0) || (a == 0 && b == 2 && c == 0) ||
      (a == 0 && b == 0 && c == 2))
    return 1;
  int h = min(a, min(b, c));
  a -= h;
  b -= h;
  c -= h;
  return ((a == b && a == c && b == c) || (a == 1 && b == 0 && c == 0) ||
          (a == 0 && b == 1 && c == 0) || (a == 0 && b == 0 && c == 1) ||
          (a == 1 && b == 1 && c == 0) || (a == 0 && b == 1 && c == 1) ||
          (a == 1 && b == 0 && c == 1));
}
int main() {
  cin >> s;
  for (int i = 0; i <= s.length(); i++) {
    if (s[i] == 'x') {
      x[i + 1]++;
    }
    if (s[i] == 'y') {
      y[i + 1]++;
    }
    if (s[i] == 'z') {
      z[i + 1]++;
    }
    x[i + 1] += x[i];
    y[i + 1] += y[i];
    z[i + 1] += z[i];
  }
  int m, l, r;
  cin >> m;
  while (m--) {
    cin >> l >> r;
    if (good(l - 1, r)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
