#include <bits/stdc++.h>
using namespace std;
string s;
int n;
int x[100010], y[100010], z[100010];
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> s;
  n = ((int)(s).size());
  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 q;
  cin >> q;
  while (q--) {
    int l, r;
    cin >> l >> r;
    l--;
    if (r - l < 3) {
      cout << "YES" << endl;
      continue;
    }
    int X = x[r] - x[l];
    int Y = y[r] - y[l];
    int Z = z[r] - z[l];
    cout << (max(X, max(Y, Z)) - min(X, min(Y, Z)) <= 1 ? "YES" : "NO") << endl;
  }
}
