#include <bits/stdc++.h>
using namespace std;
template <typename typ>
void vout(vector<typ>& v) {
  for (int vint = 0; vint < (int)(v).size(); vint++) cout << (v)[vint] << ' ';
  cout << endl;
}
template <typename typ>
void arrout(typ* arr, int l) {
  for (int i = 0; i < l; i++) cout << arr[i] << ' ';
  cout << endl;
}
int main() {
  int n;
  string s;
  cin >> s;
  n = (int)(s).size();
  int x[n + 1], y[n + 1], z[n + 1];
  x[0] = y[0] = z[0] = 0;
  for (int i = 0; i < n; ++i) {
    x[i + 1] = x[i] + (s[i] == 'x');
    y[i + 1] = y[i] + (s[i] == 'y');
    z[i + 1] = z[i] + (s[i] == 'z');
  }
  int m;
  cin >> m;
  int l, r;
  for (int i = 0; i < m; ++i) {
    cin >> l >> r;
    if (r - l + 1 < 3) {
      cout << ("YES") << endl;
      continue;
    }
    int xc = x[r] - x[l - 1];
    int yc = y[r] - y[l - 1];
    int zc = z[r] - z[l - 1];
    int mx = max(xc, max(yc, zc));
    if (xc >= mx - 1 && yc >= mx - 1 && zc >= mx - 1)
      cout << ("YES") << endl;
    else
      cout << ("NO") << endl;
  }
}
