#include <bits/stdc++.h>
using namespace std;
string s;
int n;
int x[100004], y[100004], z[100004];
int m;
int l, r;
int main() {
  cin >> s;
  n = s.size();
  for (int i = 1; i <= n; i++) {
    x[i] = x[i - 1];
    y[i] = y[i - 1];
    z[i] = z[i - 1];
    if (s[i - 1] == 'x') x[i]++;
    if (s[i - 1] == 'y') y[i]++;
    if (s[i - 1] == 'z') z[i]++;
  }
  cin >> m;
  for (; m > 0; m--) {
    cin >> l >> r;
    l--;
    if (r - l < 3) {
      cout << "YES\n";
      continue;
    }
    int mini = x[r] - x[l];
    mini = min(mini, y[r] - y[l]);
    mini = min(mini, z[r] - z[l]);
    if (x[r] - x[l] - mini > 1) {
      cout << "NO\n";
      continue;
    }
    if (y[r] - y[l] - mini > 1) {
      cout << "NO\n";
      continue;
    }
    if (z[r] - z[l] - mini > 1) {
      cout << "NO\n";
      continue;
    }
    cout << "YES\n";
  }
  return 0;
}
