#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const double PI = acos(-1.0);
const int MAXN = 1e6 + 5;
void cp() {
  string s;
  cin >> s;
  int n = ((int)s.length());
  int pref[n + 1][3];
  memset(pref, 0, sizeof(pref));
  for (int i = 1; i <= n; i++) {
    for (char j = 'x'; j <= 'z'; j++) {
      pref[i][j - 'x'] = pref[i - 1][j - 'x'] + (s[i - 1] == j);
    }
  }
  int q;
  cin >> q;
  while (q--) {
    int l, r;
    cin >> l >> r;
    vector<int> cnt(3);
    for (int i = 0; i < 3; i++) cnt[i] = pref[r][i] - pref[l - 1][i];
    int len = r - l + 1;
    int lo = len / 3;
    int hi = (len + 2) / 3;
    bool ok = true;
    for (int c : cnt)
      if ((c < lo) || (c > hi)) ok = false;
    if (len < 3) ok = true;
    cout << (ok ? "YES\n" : "NO\n");
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  t = 1;
  while (t--) {
    cp();
  }
  return 0;
}
