#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e9 + 7, S = 1e5 + 1;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) {
    string s;
    cin >> s;
    long long int n = s.length(), m;
    long long int x[n + 1], y[n + 1], z[n + 1];
    x[0] = y[0] = z[0] = 0;
    for (long long int i = 1; i < n + 1; i++) {
      x[i] = x[i - 1] + (s[i - 1] == 'x');
      y[i] = y[i - 1] + (s[i - 1] == 'y');
      z[i] = z[i - 1] + (s[i - 1] == 'z');
    }
    cin >> m;
    for (long long int i = 0; i < m; i++) {
      long long int l, r;
      cin >> l >> r;
      long long int 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;
        continue;
      }
      if (max(a, max(b, c)) > min(a, min(b, c)) + 1) {
        cout << "NO" << endl;
      } else {
        cout << "YES" << endl;
      }
    }
  }
  return 0;
}
