#include <bits/stdc++.h>
using namespace std;
char str[1000005];
int x[1000005], y[1000005], z[1000005];
int main() {
  scanf("%s", str);
  int n = strlen(str);
  x[0] = y[0] = z[0] = 0;
  for (int i = 1; i <= n; i++) {
    x[i] = x[i - 1], y[i] = y[i - 1], z[i] = z[i - 1];
    x[i] += str[i - 1] == 'x';
    y[i] += str[i - 1] == 'y';
    z[i] += str[i - 1] == 'z';
  }
  int m;
  scanf("%d", &m);
  while (m--) {
    int l, r;
    scanf("%d%d", &l, &r);
    int a = x[r] - x[l - 1], b = y[r] - y[l - 1], c = z[r] - z[l - 1];
    int t = min(min(a, b), c);
    if (abs(t - a) <= 1 && abs(t - b) <= 1 && abs(t - c) <= 1)
      printf("YES\n");
    else if (r - l + 1 <= 2)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
