#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3fffffff;
const int mmax = 100010;
string ss;
struct TR {
  int l, r;
  int cnt[3];
} T[4 * mmax];
void push(TR &T1, TR &T2, TR &T3) {
  T1.l = T2.l, T1.r = T3.r;
  T1.cnt[0] = T2.cnt[0] + T3.cnt[0];
  T1.cnt[1] = T2.cnt[1] + T3.cnt[1];
  T1.cnt[2] = T2.cnt[2] + T3.cnt[2];
}
TR Q(int id, int l, int r) {
  if (l <= T[id].l && T[id].r <= r) return T[id];
  int mid = (T[id].r + T[id].l) >> 1;
  TR tmp[3];
  int t = 0;
  if (mid >= l) tmp[1] = Q(id << 1, l, r), t++;
  if (mid < r) tmp[2] = Q(id << 1 | 1, l, r), t += 2;
  if (t <= 2) return tmp[t];
  push(tmp[0], tmp[1], tmp[2]);
  return tmp[0];
}
void build(int id, int l, int r) {
  memset(T[id].cnt, 0, sizeof T[id].cnt);
  T[id].l = l, T[id].r = r;
  if (l == r) {
    if (ss[l - 1] == 'x')
      T[id].cnt[0]++;
    else if (ss[l - 1] == 'y')
      T[id].cnt[1]++;
    else
      T[id].cnt[2]++;
    return;
  }
  int mid = (l + r) >> 1;
  build(id << 1, l, mid);
  build(id << 1 | 1, mid + 1, r);
  push(T[id], T[id << 1], T[id << 1 | 1]);
}
int main() {
  cin >> ss;
  int n = ss.size();
  build(1, 1, n);
  int m;
  scanf("%d", &m);
  while (m--) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (y - x < 2)
      cout << "YES" << endl;
    else {
      TR ans = Q(1, x, y);
      bool fg = 1;
      if (ans.cnt[0] && ans.cnt[1] && ans.cnt[2]) {
        int tmp = min(ans.cnt[0], ans.cnt[1]);
        tmp = min(ans.cnt[2], tmp);
        for (int i = 0; i < 3; i++) ans.cnt[i] -= tmp;
        for (int i = 0; i < 3; i++)
          if (ans.cnt[i] >= 2) fg = 0;
        if (fg)
          cout << "YES" << endl;
        else
          cout << "NO" << endl;
      } else
        cout << "NO" << endl;
    }
  }
  return 0;
}
