#include <bits/stdc++.h>
using namespace std;
int M;
string s;
int A, B;
int x[100001], y[100001], z[100001], d[3];
int main() {
  cin >> s;
  scanf("%d", &M);
  for (int(i) = 0; (i) < (s.size()); (i)++) {
    x[i + 1] = x[i] + (s[i] == 'x');
    y[i + 1] = y[i] + (s[i] == 'y');
    z[i + 1] = z[i] + (s[i] == 'z');
  }
  while (M--) {
    scanf("%d%d", &A, &B);
    d[0] = x[B] - x[A - 1];
    d[1] = y[B] - y[A - 1];
    d[2] = z[B] - z[A - 1];
    sort(d, d + 3);
    if (d[2] - d[0] <= 1 || d[0] + d[1] + d[2] < 3)
      puts("YES");
    else
      puts("NO");
  }
}
