#include <bits/stdc++.h>
using namespace std;
const int MAXLEN = 1e5 + 50;
int main() {
  int m, len, x, y, z, l, r, maxcnt, mincnt;
  char input[MAXLEN];
  int cnt[3][MAXLEN];
  scanf("%s", input + 1);
  len = strlen(input + 1);
  memset(cnt, 0, sizeof(cnt));
  for (int i = 1; i <= len; i++) {
    cnt[0][i] = cnt[0][i - 1];
    cnt[1][i] = cnt[1][i - 1];
    cnt[2][i] = cnt[2][i - 1];
    cnt[input[i] - 'x'][i]++;
  }
  scanf("%d", &m);
  while (m--) {
    scanf("%d%d", &l, &r);
    if (r - l + 1 < 3) {
      cout << "YES" << endl;
    } else {
      x = cnt[0][r] - cnt[0][l - 1];
      y = cnt[1][r] - cnt[1][l - 1];
      z = cnt[2][r] - cnt[2][l - 1];
      maxcnt = max(max(x, y), z);
      mincnt = min(min(x, y), z);
      if (maxcnt - mincnt >= 2)
        cout << "NO" << endl;
      else
        cout << "YES" << endl;
    }
  }
  return 0;
}
