#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
char s[100010];
int first[100010], second[100010], z[100010];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  for (int i = 1; i <= n; i++) {
    first[i] = first[i - 1];
    second[i] = second[i - 1];
    z[i] = z[i - 1];
    if (s[i - 1] == 'x') first[i]++;
    if (s[i - 1] == 'y') second[i]++;
    if (s[i - 1] == 'z') z[i]++;
  }
  int k;
  scanf("%d", &k);
  for (int i = 1; i <= k; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (r - l <= 1) {
      cout << "YES" << endl;
      continue;
    }
    int sx = first[r] - first[l - 1];
    int sy = second[r] - second[l - 1];
    int sz = z[r] - z[l - 1];
    int mn = min(sx, sy);
    smin(mn, sz);
    if (sx - mn > 1) {
      cout << "NO" << endl;
      continue;
    }
    if (sy - mn > 1) {
      cout << "NO" << endl;
      continue;
    }
    if (sz - mn > 1) {
      cout << "NO" << endl;
      continue;
    }
    cout << "YES" << endl;
  }
}
