#include <bits/stdc++.h>
using namespace std;
char s[100005];
int num[100005][3];
int so[3];
int main() {
  scanf("%s", s + 1);
  for (int i = 1; s[i]; i++) {
    for (int j = 0; j < 3; j++) num[i][j] = num[i - 1][j];
    num[i][s[i] - 'x']++;
  }
  int m, l, r;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &l, &r);
    if (r - l <= 1) {
      puts("YES");
      continue;
    }
    for (int j = 0; j < 3; j++) so[j] = num[r][j] - num[l - 1][j];
    sort(so, so + 3);
    if (so[2] - so[0] <= 1)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
