#include <bits/stdc++.h>
using namespace std;
string s;
int x[100002], y[100002], z[100002];
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); 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, l, r, X, Y, Z;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> l >> r;
    if (r - l + 1 < 3) {
      cout << "YES" << endl;
      continue;
    }
    X = x[r] - x[l - 1];
    Y = y[r] - y[l - 1];
    Z = z[r] - z[l - 1];
    if (max(X, max(Y, Z)) - min(X, min(Y, Z)) > 1)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
