#include <bits/stdc++.h>
using namespace std;
int cntx[100001], cnty[100001], cntz[100001];
char str[100001];
int main() {
  cin >> str;
  for (int i = 0; str[i]; ++i) {
    cntx[i + 1] = cntx[i];
    cnty[i + 1] = cnty[i];
    cntz[i + 1] = cntz[i];
    if (str[i] == 'x') ++cntx[i + 1];
    if (str[i] == 'y') ++cnty[i + 1];
    if (str[i] == 'z') ++cntz[i + 1];
  }
  int n;
  cin >> n;
  while (n--) {
    int l, r;
    cin >> l >> r;
    if (r - l < 2) {
      puts("YES");
      continue;
    }
    int sumx = cntx[r] - cntx[l - 1];
    int sumy = cnty[r] - cnty[l - 1];
    int sumz = cntz[r] - cntz[l - 1];
    int d1 = abs(sumx - sumy);
    int d2 = abs(sumx - sumz);
    int d3 = abs(sumy - sumz);
    if (d1 > 1 || d2 > 1 || d3 > 1)
      puts("NO");
    else
      puts("YES");
  }
  return 0;
}
