#include <bits/stdc++.h>
int FASTBUFFER;
using namespace std;
int n, m, i, l, r, ss0, ss1, ss2;
int s[100005][5];
char str[100005];
int main() {
  gets(str + 1);
  n = strlen(str + 1);
  for (i = 1; i <= n; i++) {
    s[i][0] = s[i - 1][0];
    s[i][1] = s[i - 1][1];
    s[i][2] = s[i - 1][2];
    s[i][str[i] - 'x']++;
  }
  scanf("%d", &m);
  for (i = 1; i <= m; i++) {
    scanf("%d %d", &l, &r);
    if (r - l + 1 < 3) {
      printf("YES\n");
      continue;
    }
    ss0 = s[r][0] - s[l - 1][0];
    ss1 = s[r][1] - s[l - 1][1];
    ss2 = s[r][2] - s[l - 1][2];
    if (max(ss0, max(ss1, ss2)) - min(ss0, min(ss1, ss2)) <= 1)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
