#include <bits/stdc++.h>
using namespace std;
int pref1[1000000], pref2[1000000], pref3[1000000];
int main() {
  string arr;
  cin >> arr;
  for (int i = 0; i < arr.size(); i++) {
    pref1[i + 1] = pref1[i] + (arr[i] == 'x');
    pref2[i + 1] = pref2[i] + (arr[i] == 'y');
    pref3[i + 1] = pref3[i] + (arr[i] == 'z');
  }
  int t;
  cin >> t;
  for (int o = 0; o < t; o++) {
    int a, b;
    cin >> a >> b;
    int hi1 = pref1[b] - pref1[a - 1];
    int hi2 = pref2[b] - pref2[a - 1];
    int hi3 = pref3[b] - pref3[a - 1];
    int asdf = b - a + 1;
    asdf /= 3;
    if (asdf == 0) {
      cout << "YES" << '\n';
      continue;
    }
    if ((hi1 == asdf || hi1 == asdf + 1) && (hi2 == asdf || hi2 == asdf + 1) &&
        (hi3 == asdf || hi3 == asdf + 1))
      cout << "YES" << '\n';
    else
      cout << "NO" << '\n';
  }
  return 0;
}
