#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int)1e5 + 10;
int sx[MAXN], sy[MAXN], sz[MAXN];
char s[MAXN];
void solve(int x, int y, int z) {
  if (x + y + z < 3) {
    printf("YES\n");
    return;
  }
  int e = (x + y + z) / 3;
  vector<int> v;
  v.push_back(x);
  v.push_back(y);
  v.push_back(z);
  sort(v.begin(), v.end());
  if ((x + y + z) % 3 == 0) {
    if (x == e && y == e && z == e)
      printf("YES\n");
    else
      printf("NO\n");
    return;
  } else if ((x + y + z) % 3 == 1) {
    if (v[2] == e + 1 && v[1] == e)
      printf("YES\n");
    else
      printf("NO\n");
    return;
  } else {
    if (v[2] == e + 1 && v[1] == e + 1)
      printf("YES\n");
    else
      printf("NO\n");
    return;
  }
}
int main() {
  scanf("%s", s);
  int n = strlen(s);
  for (int i = 1; i <= n; i++) {
    sx[i] = sx[i - 1] + (s[i - 1] == 'x');
    sy[i] = sy[i - 1] + (s[i - 1] == 'y');
    sz[i] = sz[i - 1] + (s[i - 1] == 'z');
  }
  int m;
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    int x = sx[r] - sx[l - 1], y = sy[r] - sy[l - 1], z = sz[r] - sz[l - 1];
    solve(x, y, z);
  }
  return 0;
}
