#include <bits/stdc++.h>
using namespace std;
int s1[100005];
int s2[100005];
int s3[100005];
string s11 = "xzy";
string s22 = "yxz";
string s33 = "zyx";
bool ok(int l, int r) {
  int a, b, c, d;
  a = s1[r];
  b = s2[r];
  c = s3[r];
  if (l != 0) {
    a -= s1[l - 1];
    b -= s2[l - 1];
    c -= s3[l - 1];
  }
  if (r - l + 1 < 3) return true;
  if (a == 0 || b == 0 || c == 0) return false;
  d = (r - l + 1) / 3;
  if (d != a && d != a - 1) return false;
  if (d != b && d != b - 1) return false;
  if (d != c && d != c - 1) return false;
  return true;
}
bool ok1(string s1, string s2) {
  int cnt = 0;
  for (int i = 0; i < s1.size(); i++) {
    if (s1[i] == s2[cnt]) {
      cnt++;
      if (cnt == 3) return 1;
    }
  }
  return 0;
}
int main() {
  string s;
  cin >> s;
  int l = s.size();
  for (int i = 0; i < l; i++) {
    if (i != 0) {
      s1[i] = s1[i - 1];
      s2[i] = s2[i - 1];
      s3[i] = s3[i - 1];
    }
    if (s[i] == 'x') s1[i]++;
    if (s[i] == 'y') s2[i]++;
    if (s[i] == 'z') s3[i]++;
  }
  int k;
  cin >> k;
  for (int i = 0; i < k; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    int a = s1[y] - s1[x - 1];
    int b = s2[y] - s2[x - 1];
    int c = s3[y] - s3[x - 1];
    if (ok(x, y)) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
}
