#include <bits/stdc++.h>
using namespace std;
int map1[1000];
int b[1001][4], end1;
string s1, s;
long long n, k, l, r, j, a[1000001], res = 0, i, m, d[1000001], x, y, z,
                                     X[1000001], Y[1000001], Z[1000001];
int main() {
  s += " ";
  cin >> s1;
  s += s1;
  for (i = 1; i < s.size(); i++) {
    if (s[i] == 'x') x++;
    if (s[i] == 'y') y++;
    if (s[i] == 'z') z++;
    X[i] = x;
    Y[i] = y;
    Z[i] = z;
  }
  cin >> m;
  for (i = 1; i <= m; i++) {
    cin >> l >> r;
    if (r - l < 2) {
      cout << "YES" << endl;
    } else {
      int sumx = 0, sumy = 0, sumz = 0;
      sumx = X[r] - X[l - 1];
      sumy = Y[r] - Y[l - 1];
      sumz = Z[r] - Z[l - 1];
      int man = min(sumx, min(sumy, sumz));
      if (sumx - man <= 1 && sumy - man <= 1 && sumz - man <= 1) {
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }
    }
  }
  return 0;
}
