#include <bits/stdc++.h>
using namespace std;
const int Max = 100100;
int num_x[Max] = {0};
int num_y[Max] = {0};
int num_z[Max] = {0};
string s;
int l;
void k_r() {
  for (int i = 1; i <= l; i++) {
    if (s[i - 1] == 'x') {
      num_x[i] = num_x[i - 1] + 1;
      num_y[i] = num_y[i - 1];
      num_z[i] = num_z[i - 1];
    }
    if (s[i - 1] == 'y') {
      num_x[i] = num_x[i - 1];
      num_y[i] = num_y[i - 1] + 1;
      num_z[i] = num_z[i - 1];
    }
    if (s[i - 1] == 'z') {
      num_x[i] = num_x[i - 1];
      num_y[i] = num_y[i - 1];
      num_z[i] = num_z[i - 1] + 1;
    }
  }
}
int main() {
  cin >> s;
  l = s.length();
  k_r();
  int n, l, r;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &l, &r);
    int x, y, z, t;
    x = num_x[r] - num_x[l - 1];
    y = num_y[r] - num_y[l - 1];
    z = num_z[r] - num_z[l - 1];
    t = max(max(x, y), z) - min(min(x, y), z);
    if (t > 1 && r - l >= 2)
      printf("NO\n");
    else
      printf("YES\n");
  }
  return 0;
}
