#include <bits/stdc++.h>
using namespace std;
string s;
int n;
int a[333333], l, r, m;
int f[33];
int nxt[333333][3];
int ss[333333][3];
int sum(int l, int r, int x) {
  int f = ss[r][x];
  if (l) f -= ss[l - 1][x];
  return f;
}
int main() {
  ios ::sync_with_stdio(false);
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; ++i)
    if (s[i] == 'x')
      a[i] = 0;
    else if (s[i] == 'y')
      a[i] = 1;
    else
      a[i] = 2;
  for (int i = 0; i < 3; ++i) f[i] = n + 1;
  ss[0][a[0]] = 1;
  for (int i = 1; i < n; ++i) {
    ss[i][a[i]]++;
    for (int j = 0; j < 3; ++j) ss[i][j] += ss[i - 1][j];
  }
  cin >> m;
  for (int i = 0; i < m; ++i) {
    cin >> l >> r;
    l--;
    r--;
    string ok = "YES";
    if (r - l + 1 < 3) {
      cout << ok << endl;
      continue;
    }
    int q1, q2, q3, t, ans;
    q1 = sum(l, r, 0);
    q2 = sum(l, r, 1);
    q3 = sum(l, r, 2);
    t = min(q1, min(q2, q3));
    ans = q1 + q2 + q3 - t * 3;
    if (ans > 2)
      ok = "NO";
    else if (q1 - t > 1 || q2 - t > 1 || q3 - t > 1)
      ok = "NO";
    cout << ok << endl;
  }
  return 0;
}
