#include <bits/stdc++.h>
using namespace std;
int a[100010][5];
char s[100010];
int main() {
  int i, j, n, m, tt, k;
  int L, R, x1, x2, y1, y2, z1, z2;
  bool flag;
  while (scanf("%s", s) != EOF) {
    n = strlen(s);
    memset(a, 0, sizeof(a));
    for (i = 0; i < n; i++) {
      m = s[i] - 'x' + 1;
      a[i + 1][1] = a[i][1];
      a[i + 1][2] = a[i][2];
      a[i + 1][3] = a[i][3];
      a[i + 1][m]++;
    }
    cin >> m;
    while (m--) {
      scanf("%d%d", &L, &R);
      if (R - L < 2) {
        puts("YES");
        continue;
      }
      x1 = a[L - 1][1];
      y1 = a[L - 1][2];
      z1 = a[L - 1][3];
      x2 = a[R][1];
      y2 = a[R][2];
      z2 = a[R][3];
      x2 -= x1;
      y2 -= y1;
      z2 -= z1;
      i = min(x2, min(y2, z2));
      j = max(x2, max(y2, z2));
      if (j - i <= 1) {
        puts("YES");
      } else {
        puts("NO");
      }
    }
  }
  return 0;
}
