#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.length();
  vector<int> x(1 + n);
  vector<int> y(1 + n);
  vector<int> z(1 + n);
  for (int i = 1; i <= n; i++) {
    switch (s[i - 1]) {
      case 'x':
        x[i] = 1;
        break;
      case 'y':
        y[i] = 1;
        break;
      case 'z':
        z[i] = 1;
        break;
    }
  }
  for (int i = 1; i <= n; i++) {
    x[i] = x[i - 1] + x[i];
    y[i] = y[i - 1] + y[i];
    z[i] = z[i - 1] + z[i];
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    int nx, ny, nz;
    nx = x[r] - x[l - 1];
    ny = y[r] - y[l - 1];
    nz = z[r] - z[l - 1];
    vector<int> a = {nx, ny, nz};
    sort(a.begin(), a.end());
    if (r - l < 2 || a[2] - a[0] <= 1) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
