#include <bits/stdc++.h>
using namespace std;
string s;
int x[100005];
int y[100005];
int z[100005];
int main() {
  ios_base::sync_with_stdio(0);
  ;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'x') {
      x[i + 1]++;
    } else if (s[i] == 'y') {
      y[i + 1]++;
    } else {
      z[i + 1]++;
    }
  }
  for (int i = 1; i <= s.size(); i++) {
    x[i] = x[i] + x[i - 1];
    y[i] = y[i] + y[i - 1];
    z[i] = z[i] + z[i - 1];
  }
  int q, l, r;
  cin >> q;
  while (q--) {
    cin >> l >> r;
    if (r - l + 1 <= 2) {
      cout << "YES\n";
      continue;
    }
    int xx = x[r] - x[l - 1];
    int yy = y[r] - y[l - 1];
    int zz = z[r] - z[l - 1];
    vector<int> v;
    v.push_back(xx);
    v.push_back(yy);
    v.push_back(zz);
    sort((v).begin(), (v).end());
    int ok = 0;
    if (v[0] == v[1] && v[1] == v[2]) {
      ok = 1;
    }
    if (v[0] == v[1] && ((v[1] + 1) == (v[2]))) {
      ok = 1;
    }
    if (v[1] == v[2] && ((v[1] - 1) == v[0])) {
      ok = 1;
    }
    if (ok)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
