#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:33554432")
int N, Q, cnt[3][100005];
char A[100005];
int main() {
  int i, j, k;
  scanf("%s", A + 1);
  N = strlen(A + 1);
  for (i = 1; i <= N; i++) {
    for (j = 0; j < 3; j++) cnt[j][i] += cnt[j][i - 1];
    cnt[A[i] - 'x'][i]++;
  }
  for (scanf("%d", &Q); Q--;) {
    int c[3] =
        {
            0,
        },
        s, e;
    scanf("%d%d", &s, &e);
    for (i = 0; i < 3; i++) c[i] = cnt[i][e] - cnt[i][s - 1];
    int mx = 0, mn = 1e9;
    for (i = 0; i < 3; i++) mx = max(mx, c[i]), mn = min(mn, c[i]);
    if (e - s + 1 < 3 || mx - mn < 2)
      puts("YES");
    else
      puts("NO");
  }
}
