#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1e5;
int n;
char s[MaxN + 5];
int l[MaxN + 5], r[MaxN + 5];
struct num {
  int x, y, z;
} a[MaxN + 5];
int main() {
  int o = 0, p = 0, q = 0;
  scanf("%s", s + 1);
  scanf("%d", &n);
  int len = strlen(s + 1);
  for (int i = 1; i <= len; i++) {
    if (s[i] == 'x')
      o++;
    else if (s[i] == 'y')
      p++;
    else
      q++;
    a[i].x = o, a[i].y = p, a[i].z = q;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &l[i], &r[i]);
    o = 0, p = 0, q = 0;
    if (r[i] - l[i] < 2)
      printf("YES\n");
    else {
      o = a[r[i]].x - a[l[i]].x;
      p = a[r[i]].y - a[l[i]].y;
      q = a[r[i]].z - a[l[i]].z;
      if (s[l[i]] == 'x')
        o++;
      else if (s[l[i]] == 'y')
        p++;
      else
        q++;
      int MAX = max(max(o, p), q);
      int MIN = min(min(o, p), q);
      if (MAX - MIN < 2)
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
  return 0;
}
