#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, l, r;
  char str[100002];
  int count[100002][3];
  cin >> str;
  cin >> m;
  count[0][0] = 0;
  count[0][1] = 0;
  count[0][2] = 0;
  for (int i = 1; str[i - 1] != '\0'; i++) {
    count[i][0] = count[i - 1][0];
    count[i][1] = count[i - 1][1];
    count[i][2] = count[i - 1][2];
    count[i][str[i - 1] - 'x'] += 1;
  }
  for (int i = 0; i < m; i++) {
    cin >> l >> r;
    if (r - l < 2) {
      cout << "YES" << endl;
    } else {
      int xcount = count[r][0] - count[l - 1][0];
      int ycount = count[r][1] - count[l - 1][1];
      int zcount = count[r][2] - count[l - 1][2];
      int minVal = min(xcount, min(ycount, zcount));
      int maxVal = max(xcount, max(ycount, zcount));
      if ((maxVal - minVal) <= 1) {
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }
    }
  }
  return 0;
}
