#include <bits/stdc++.h>
using namespace std;
char s[100010];
int x[100010], y[100010], z[100010];
void input() {
  scanf("%s", s);
  for (int i = 0; s[i]; ++i) {
    if (s[i] == 'x') x[i + 1]++;
    if (s[i] == 'y') y[i + 1]++;
    if (s[i] == 'z') z[i + 1]++;
    x[i + 1] += x[i];
    y[i + 1] += y[i];
    z[i + 1] += z[i];
  }
  int m, a, b;
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &a, &b);
    if (b - a < 2) {
      printf("YES\n");
    } else {
      int nx = x[b] - x[a - 1];
      int ny = y[b] - y[a - 1];
      int nz = z[b] - z[a - 1];
      if (max(max(nx, ny), nz) - min(min(nx, ny), nz) <= 1)
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
}
int main() {
  input();
  return 0;
}
