#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  string s;
  cin >> s;
  int l = s.length();
  vector<vector<int>> count(l + 1, vector<int>(3));
  for (size_t i = 0; i < s.length(); i++) {
    copy(count[i].begin(), count[i].end(), count[i + 1].begin());
    count[i + 1][s[i] - 'x']++;
  }
  int queries;
  cin >> queries;
  for (int i = 0; i < queries; i++) {
    int a, b;
    cin >> a >> b;
    if (b - a <= 1)
      cout << "YES";
    else {
      int scount[3] = {};
      for (int j = 0; j < 3; j++) scount[j] = count[b][j] - count[a - 1][j];
      sort(scount, scount + 3);
      if (scount[2] - scount[0] <= 1)
        cout << "YES";
      else
        cout << "NO";
    }
    cout << endl;
  }
  return 0;
}
