#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, z, p, q, r;
int ara[5];
string str;
int csum[4][200000];
int main() {
  cin >> str;
  str = "?" + str;
  for (int i = 1; i < str.size(); i++) {
    int ch = str[i] - 'x';
    csum[ch][i]++;
    for (int j = 0; j < 3; j++) csum[j][i] += csum[j][i - 1];
  }
  cin >> q;
  while (q--) {
    scanf("%d %d", &x, &y);
    for (int i = 0; i < 3; i++) ara[i] = csum[i][y] - csum[i][x - 1];
    sort(ara, ara + 3);
    reverse(ara, ara + 3);
    if (ara[0] - ara[2] <= 1 || y - x <= 1) {
      printf("YES\n");
    } else
      printf("NO\n");
  }
  return 0;
}
