#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int cnt[5];
char a[maxn];
int x[maxn], y[maxn], z[maxn];
int Abs(int x) { return x < 0 ? (-x) : x; }
bool can(int x, int y, int z) {
  if (x == y && (Abs(z - x) <= 1)) return true;
  return false;
}
int main() {
  int n, l, r;
  scanf("%s%d", a, &n);
  int len = strlen(a);
  x[0] = y[0] = z[0] = 0;
  for (int i = 0; i < len; i++) {
    if (a[i] == 'x') {
      x[i + 1] = x[i] + 1;
      y[i + 1] = y[i];
      z[i + 1] = z[i];
    } else if (a[i] == 'y') {
      y[i + 1] = y[i] + 1;
      x[i + 1] = x[i];
      z[i + 1] = z[i];
    } else {
      z[i + 1] = z[i] + 1;
      x[i + 1] = x[i];
      y[i + 1] = y[i];
    }
  }
  while (n--) {
    scanf("%d%d", &l, &r);
    if (r - l + 1 < 3) {
      printf("YES\n");
      continue;
    }
    int numx = x[r] - x[l - 1], numy = y[r] - y[l - 1], numz = z[r] - z[l - 1];
    if (can(numx, numy, numz) || can(numx, numz, numy) || can(numy, numz, numx))
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
