#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:255000000")
using namespace std;
long double eps = 1e-7;
const int BASE = (int)1e9;
const long double PI = 3.1415926535897932384626433832795;
const int MOD = (int)1e9 + 7;
const int HMOD = (1 << 22) - 1;
const int N = 110000;
const int INF = 1 << 30;
int n, m;
char s[110000];
int len = 0;
int cnt[110000][3];
void Calc() {
  for (int i = 1; i <= len; i++) {
    for (int j = 0; j < 3; j++) cnt[i][j] = cnt[i - 1][j];
    cnt[i][s[i - 1] - 'x']++;
  }
}
int main() {
  gets(s);
  len = strlen(s);
  Calc();
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    int L, R;
    scanf("%d%d", &L, &R);
    if (R - L < 2) {
      printf("YES\n");
      continue;
    }
    int res[3] = {cnt[R][0] - cnt[L - 1][0], cnt[R][1] - cnt[L - 1][1],
                  cnt[R][2] - cnt[L - 1][2]};
    int Max = res[0];
    int Min = res[0];
    for (int j = 1; j < 3; j++) {
      Max = max(Max, res[j]);
      Min = min(Min, res[j]);
    }
    if (Max - Min > 1)
      printf("NO\n");
    else
      printf("YES\n");
  }
  return 0;
}
