#include <bits/stdc++.h>
using namespace std;
long long int i, j, n;
int main() {
  string s;
  cin >> s;
  n = s.size();
  long long int cx[n + 1], cy[n + 1], cz[n + 1];
  memset(cx, 0, sizeof cx);
  memset(cy, 0, sizeof cy);
  memset(cz, 0, sizeof cz);
  for (i = 1; i <= n; i++) {
    cx[i] = cx[i - 1];
    cz[i] = cz[i - 1];
    cy[i] = cy[i - 1];
    if (s[i - 1] == 'x') cx[i]++;
    if (s[i - 1] == 'y') cy[i]++;
    if (s[i - 1] == 'z') cz[i]++;
  }
  long long int q;
  cin >> q;
  while (q--) {
    long long int l, r;
    cin >> l >> r;
    if (r - l <= 1)
      cout << "YES" << endl;
    else {
      long long int a1 = abs(cx[l - 1] - cx[r]);
      long long int a2 = abs(cy[l - 1] - cy[r]);
      long long int a3 = abs(cz[l - 1] - cz[r]);
      long long int minval = min(a1, min(a2, a3));
      long long int maxval = max(a1, max(a2, a3));
      if (maxval - minval <= 1)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
  return 0;
}
