#include <bits/stdc++.h>
using namespace std;
const double eps(1e-8);
char s[100010];
int dp[100010][4];
int main() {
  scanf("%s", s);
  int len = strlen(s);
  for (int i = 1; i <= len; i++) {
    if (s[i - 1] == 'x')
      dp[i][1] = dp[i - 1][1] + 1;
    else
      dp[i][1] = dp[i - 1][1];
    if (s[i - 1] == 'y')
      dp[i][2] = dp[i - 1][2] + 1;
    else
      dp[i][2] = dp[i - 1][2];
    if (s[i - 1] == 'z')
      dp[i][3] = dp[i - 1][3] + 1;
    else
      dp[i][3] = dp[i - 1][3];
  }
  int m;
  scanf("%d", &m);
  int x, y;
  while (m--) {
    scanf("%d %d", &x, &y);
    if (y - x + 1 < 3) {
      printf("YES\n");
      continue;
    }
    int cntx = dp[y][1] - dp[x - 1][1];
    int cnty = dp[y][2] - dp[x - 1][2];
    int cntz = dp[y][3] - dp[x - 1][3];
    int mm = min(cntx, min(cnty, cntz));
    cntx -= mm, cnty -= mm, cntz -= mm;
    if (cntx <= 1 && cnty <= 1 && cntz <= 1 && cntx + cnty + cntz <= 2)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
