#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int len = s.length();
  int cntx[len + 1], cnty[len + 1], cntz[len + 1];
  memset(cntx, 0, sizeof(cntx));
  memset(cnty, 0, sizeof(cnty));
  memset(cntz, 0, sizeof(cntz));
  for (int i = 1; i <= len; ++i) {
    if (s[i - 1] == 'x') {
      cntx[i] = cntx[i - 1] + 1;
      cnty[i] = cnty[i - 1];
      cntz[i] = cntz[i - 1];
    } else if (s[i - 1] == 'y') {
      cntx[i] = cntx[i - 1];
      cnty[i] = cnty[i - 1] + 1;
      cntz[i] = cntz[i - 1];
    } else {
      cntx[i] = cntx[i - 1];
      cnty[i] = cnty[i - 1];
      cntz[i] = cntz[i - 1] + 1;
    }
  }
  int m, l, r;
  cin >> m;
  while (m--) {
    cin >> l >> r;
    if (r - l < 2) {
      cout << "YES" << endl;
      continue;
    }
    int cx = cntx[r] - cntx[l - 1];
    int cy = cnty[r] - cnty[l - 1];
    int cz = cntz[r] - cntz[l - 1];
    if ((cx == cy && (cz == cx + 1 || cz == cx - 1)) ||
        (cx == cz && (cy == cx + 1 || cy == cx - 1)) ||
        (cy == cz && (cx == cy + 1 || cx == cy - 1)) || (cx == cy && cy == cz))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
