#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 12;
int xx[N][3];
int yy[3];
char str[N];
int main() {
  scanf("%s", str);
  memset(xx, 0, sizeof(xx));
  int n = strlen(str);
  int m;
  scanf("%d", &m);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 3; j++) {
      if (j == str[i] - 'x')
        xx[i + 1][j] = 1 + xx[i][j];
      else
        xx[i + 1][j] = xx[i][j];
    }
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    for (int j = 0; j < 3; j++) yy[j] = xx[b][j] - xx[a - 1][j];
    sort(yy, yy + 3);
    if (yy[2] - yy[0] <= 1 || b - a <= 1)
      printf("YES\n");
    else
      printf("NO\n");
  }
}
