#include <bits/stdc++.h>
using namespace std;
long long m, dum, yum;
vector<long long> l, r;
long long nox[(long long)1e5 + 1], noy[(long long)1e5 + 1],
    noz[(long long)1e5 + 1];
int main() {
  string s;
  cin >> s;
  int n = (int)s.length();
  for (int i = 0; i <= n; i++) {
    nox[i] = 0;
    noy[i] = 0;
    noz[i] = 0;
  }
  long long noxc = 0, noyc = 0, nozc = 0;
  for (int i = 1; i <= n; i++) {
    noxc += (s[i - 1] == 'x');
    noyc += (s[i - 1] == 'y');
    nozc += (s[i - 1] == 'z');
    nox[i] = noxc;
    noy[i] = noyc;
    noz[i] = nozc;
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> dum >> yum;
    if ((yum - dum) <= 1) {
      cout << "YES\n";
      continue;
    }
    noxc = nox[yum] - nox[dum - 1];
    noyc = noy[yum] - noy[dum - 1];
    nozc = noz[yum] - noz[dum - 1];
    if ((((noxc - noyc) <= 1) && ((noxc - noyc) >= -1)) &&
        (((noyc - nozc) <= 1) && ((noyc - nozc) >= -1)) &&
        (((nozc - noxc) <= 1) && ((nozc - noxc) >= -1)))
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
