#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int m;
  cin >> m;
  vector<int> x(s.size() + 1), y(s.size() + 1), z(s.size() + 1);
  for (int i = 1; i <= s.size(); ++i) {
    x[i] = x[i - 1];
    y[i] = y[i - 1];
    z[i] = z[i - 1];
    switch (s[i - 1]) {
      case 'x':
        ++x[i];
        break;
      case 'y':
        ++y[i];
        break;
      case 'z':
        ++z[i];
        break;
    }
  }
  int l, r, a, b, c;
  for (int i = 0; i < m; ++i) {
    cin >> l >> r;
    a = x[r] - x[l - 1];
    b = y[r] - y[l - 1];
    c = z[r] - z[l - 1];
    if (r - l + 1 < 3)
      cout << "YES" << endl;
    else if (abs((double)a - b) > 1 || abs((double)a - c) > 1 ||
             abs((double)c - b) > 1)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
