#include <bits/stdc++.h>
using namespace std;
int check[100000][3];
int main() {
  char s[100001];
  int m, a, b;
  scanf("%s", s);
  int t = strlen(s);
  check[0][s[0] - 120]++;
  for (int i = 1; i < t; i++) {
    check[i][s[i] - 120]++;
    check[i][0] += check[i - 1][0];
    check[i][1] += check[i - 1][1];
    check[i][2] += check[i - 1][2];
  }
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &a, &b);
    int x = check[b - 1][0] - check[a - 1][0] + (s[a - 1] == 'x');
    int y = check[b - 1][1] - check[a - 1][1] + (s[a - 1] == 'y');
    int z = check[b - 1][2] - check[a - 1][2] + (s[a - 1] == 'z');
    if (max(x, max(y, z)) - min(x, min(y, z)) <= 1 || b - a <= 1)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
