#include <bits/stdc++.h>
typedef struct {
  int x, y, z;
} Data;
Data data[100001];
int main(void) {
  int i;
  char s[100001];
  int n, m;
  scanf("%s %d", s, &m);
  n = strlen(s);
  for (i = 1; i <= n; i++) {
    data[i].x = data[i - 1].x + (s[i - 1] == 'x');
    data[i].y = data[i - 1].y + (s[i - 1] == 'y');
    data[i].z = data[i - 1].z + (s[i - 1] == 'z');
  }
  for (i = 0; i < m; i++) {
    int l, r, x, y, z;
    scanf("%d %d", &l, &r);
    x = data[r].x - data[l - 1].x;
    y = data[r].y - data[l - 1].y;
    z = data[r].z - data[l - 1].z;
    if (r - l == 1)
      puts("YES");
    else
      puts(x == y && y == z || x == y && z == x + 1 || x == y && z == x - 1 ||
                   y == z && x == y + 1 || y == z && x == y - 1 ||
                   z == x && y == z + 1 || z == x && y == z - 1
               ? "YES"
               : "NO");
  }
  return 0;
}
